seam-carve

seam_carve

skimage.transform.seam_carve(img, energy_map, mode, num, border=1, force_copy=True) [source]

Carve vertical or horizontal seams off an image.

Carves out vertical/horizontal seams from an image while using the given energy map to decide the importance of each pixel.

Parameters:

image : (M, N) or (M, N, 3) ndarray

Input image whose seams are to be removed.

energy_map : (M, N) ndarray

The array to decide the importance of each pixel. The higher the value corresponding to a pixel, the more the algorithm will try to keep it in the image.

mode : str {‘horizontal’, ‘vertical’}

Indicates whether seams are to be removed vertically or horizontally. Removing seams horizontally will decrease the height whereas removing vertically will decrease the width.

num : int

Number of seams are to be removed.

border : int, optional

The number of pixels in the right, left and bottom end of the image to be excluded from being considered for a seam. This is important as certain filters just ignore image boundaries and set them to 0. By default border is set to 1.

force_copy : bool, optional

If set, the image and energy_map are copied before being used by the method which modifies it in place. Set this to False if the original image and the energy map are no longer needed after this opetration.

Returns:

out : ndarray

The cropped image with the seams removed.

References

[R381] Shai Avidan and Ariel Shamir “Seam Carving for Content-Aware Image Resizing” http://www.cs.jhu.edu/~misha/ReadingSeminar/Papers/Avidan07.pdf
doc_scikit_image
2017-01-12 17:23:26
Comments
Leave a Comment

Please login to continue.