3 ms·
Very interesting, the steps for the algo are mentionned as: 1) Load an image. 2) Calculate energy of each pixel. 3) Find seams. 4) Remove seams. My question he
by kelvin0 7y ago
Very interesting, the steps for the algo are mentionned as:
1) Load an image.
2) Calculate energy of each pixel.
3) Find seams.
4) Remove seams.
My question here is: once #4 has been completed how do you 'merge' the pixels that are left once the seam pixels have been 'discarded'?
- jedimastert 7y agoThe "seam" is one pixel from each row (or column) connected together either vertically(/horizontally) or diagonally. You're left with two halves that you just connect. for instance 1|2|x|4 1|x|3|4 1|x|3|4 x|2|3|4 becomes 1|2|4 1|3|4 1|3|4 2|3|4
- mstade 7y agoYou could of course interpolate the pixels on either side of the seam, but I think most implementations of this technique just drop the seam pixels and leave the other ones untouched. You can think of seam carving more as an intelligent crop than a resize operation, with the difference from a regular crop being you're not just chopping off rectangles on either side of the image, but actually selecting a path of pixels to remove. Key is you're removing one pixel from every column or row (depending on whether you're carving in the horizontal or vertical direction) so you're not ending up with jagged edges of the picture, and the seam always goes side to side or top to bottom, never side to top or side to bottom. If by chance your energy function generates seams that look exactly like rectangles on either side of your picture, it'd be indistinguishable from a regular crop.