3 ms·
I wonder if you can make the same demo with real images using seam carving. See the example images in wiki: https://en.wikipedia.org/wiki/Seam_carving https://
by fyp 7y ago
I wonder if you can make the same demo with real images using seam carving.
See the example images in wiki: https://en.wikipedia.org/wiki/Seam_carving https://en.wikipedia.org/wiki/Seam_carving
Or online demo: https://alexander.soto.io/seam-carving https://alexander.soto.io/seam-carving
- vanderZwan 7y agoProbably not quite, because the order in which you carve seams matters for every variant that I'm aware of (forward of backward energy seam carving). That is, if you reduce a 200x200 image to 100x100, you get a different result if you do that in order 200x200 -> 100x200 -> 100x100 than if you do that in order 200x200 -> 200x100 -> 100x100. But if you constrain it so that any reduced resolution is carved by stepping through the path that represents a straight line from the original image, and pre-generate all images, you might end up with something that looks smooth.
- tripzilch 7y agoWhat if you do it (I realize I should probably just try coding this myself), step-by-step, alternating? Like 200x200 -> 199x200 -> 199x199 -> etc (I forget the specifics of how seam carving works again, so maybe this approach makes no sense)
- vanderZwan 7y agoThat's more or less what I was trying to convey: for any size reduction, take the route that follows the path with the shortest Euclidian distance[1] (as opposed to Manhattan distance[1]) from the original resolution. If you do that, then the transitions should look quite smooth. You better memoize the intermediate results if you want decent performance though ;) So yes, I think your line of thought is on the right track! [0] https://en.wikipedia.org/wiki/Euclidean_distance https://en.wikipedia.org/wiki/Euclidean_distance [1] https://en.wikipedia.org/wiki/Taxicab_geometry https://en.wikipedia.org/wiki/Taxicab_geometry
- jones1618 7y agoCool idea. I don't see why you couldn't do this. First, run seam carving at a few sample aspect ratios but modify the algorithm to keep track of what regions are carved. Create a kind of heatmap that records the "disposibility" of each pixel (probably in two dimensions, x and y) interpolated from the sample seam carved images. Use that to remove or add pixels as the user resizes the image.