Live data from Hacker News

Parallel Seam Carving

shwestrick.github.io

11–20 of 39 posts

Re: Parallel Seam Carving

#11
Does repeated single-pixel seam-carving minimise energy for the "remove n seams" problem? If not, is the global algorithm in P?

Also, I guess this is beside the point, but surely almost all of the DP structure can be reused if you're repeatedly removing seams...

Re: Parallel Seam Carving

#12
post #4

Barrier synchronization is always going to wreck parallel performance. When possible, it's good to break up your work so that data dependencies are explicit and fine grained. So instead of breaking up work like this: IIIIJJJJKKKKLLLL EEEEFFFFGGGGHHHH AAAABBBBCCCCDDDD ... where each row is dependent on the entire previous row, break it up like this: HHHHIIIIJJJJKKKK EEEEEEFFFFGGGGGG AAAABBBBCCCCDDDD Where E is depende…

This pencil and paper approach to breaking up work is good at parallelizing things that don't appear parallelizable at first glance, e.g. prefix sum [1]. Compilers are good at identifying opportunities to reorder instructions in ways that break low level data dependencies. They tend to miss the big higher level opportunities like this.

[1] https://en.wikipedia.org/wiki/Prefix_sum#:~:text=A%20work%2D....

Re: Parallel Seam Carving

#13
post #2

That's really neat. What are some practical applications for Seam Carving? Maybe in video games with dynamic resizing of landscapes?

I have a photo of my friend, his ex-wife and a few others standing together on a camping trip. I wanted to share that photo with the group since it was the tenth anniversary of that trip, but didn't want to remind my friend of his divorce, so I used seam carving to elide his ex-wife. (The tool I used allows you to paint areas of low or high energy.) The result was almost seamless (pun intended) and you wouldn't notice anything amiss if you weren't looking for it.

Re: Parallel Seam Carving

#14
post #3
post #2

That's really neat. What are some practical applications for Seam Carving? Maybe in video games with dynamic resizing of landscapes?

Check out the original SIGGRAPH presentation on it. There are lots of really great demos. It's one thing to read about the algorithm, but to see it in action is magical. https://www.youtube.com/watch?v=6NcIJXTlugc This is still amazing all of these years later.

That... that was mind-blowing.

This discovery is 13 years old. Although it has clear limitations when it comes to humans, I'm surprised I don't see this kind of resize feature available in more software. Does Photoshop have this hidden in a drawer somewhere? Does imagemagick support this?

Re: Parallel Seam Carving

#15
post #14
post #3

Earlier quoted context omitted.

Check out the original SIGGRAPH presentation on it. There are lots of really great demos. It's one thing to read about the algorithm, but to see it in action is magical. https://www.youtube.com/watch?v=6NcIJXTlugc This is still amazing all of these years later.

That... that was mind-blowing. This discovery is 13 years old. Although it has clear limitations when it comes to humans, I'm surprised I don't see this kind of resize feature available in more software. Does Photoshop have this hidden in a drawer somewhere? Does imagemagick support this?

I seriously cannot decide if your post is satire. Directly from the wikipedia article:

http://www.photoshopsupport.com/photoshop-cs4/what-is-new-in...

http://www.imagemagick.org/Usage/resize/#liquid-rescale

Re: Parallel Seam Carving

#16
post #14

Earlier quoted context omitted.

That... that was mind-blowing. This discovery is 13 years old. Although it has clear limitations when it comes to humans, I'm surprised I don't see this kind of resize feature available in more software. Does Photoshop have this hidden in a drawer somewhere? Does imagemagick support this?

I seriously cannot decide if your post is satire. Directly from the wikipedia article: http://www.photoshopsupport.com/photoshop-cs4/what-is-new-in... http://www.imagemagick.org/Usage/resize/#liquid-rescale

Not at all. I have a pretty cursory knowledge of Photoshop and imagemagick (whenever I use either one I have to constantly google things).

Re: Parallel Seam Carving

#18
post #16

Earlier quoted context omitted.

I seriously cannot decide if your post is satire. Directly from the wikipedia article: http://www.photoshopsupport.com/photoshop-cs4/what-is-new-in... http://www.imagemagick.org/Usage/resize/#liquid-rescale

Not at all. I have a pretty cursory knowledge of Photoshop and imagemagick (whenever I use either one I have to constantly google things).

Seam Carving is available in GIMP with the "Liquid Rescale" plugin.

$ apt install gimp-plugin-registry

GIMP->Layer->Liquid Rescale

Re: Parallel Seam Carving

#19

Does repeated single-pixel seam-carving minimise energy for the "remove n seams" problem? If not, is the global algorithm in P? Also, I guess this is beside the point, but surely almost all of the DP structure can be reused if you're repeatedly removing seams...

> Also, I guess this is beside the point, but surely almost all of the DP structure can be reused if you're repeatedly removing seams...

It's not besides the point at all. If you can reduce this linear-time algorithm to, say, amortized constant, then you'll handily beat parallelism.

After you remove a seam, you need to recompute the cones below every removed pixel -- which ends up being the cone below the topmost removed pixel (sadly, you can't just zip down the neighbors of the seam, but you can avoid expensive data moves with a 2d linked list). If the image is super wide, that gives you a speedup by approximately the aspect ratio. If it's square, you should be able to cut the runtime in half. If it's tall and skinny, neither this nor the author's approach are terribly helpful.

Re: Parallel Seam Carving

#20
I created a desktop GUI tool [0] that used multiple cores for seam carving images of your choice. Including masking parts of image to keep or remove. The backend code parallelizing the work is from the CAIRE project.

It was ages ago, and has since been archived on google code :)

[0] https://code.google.com/archive/p/seam-carving-gui/ [1] https://github.com/esimov/caire

Post reply on HN