Details and Options
Content-aware image resizing uses seam carving or seam insertion to crop or to extend images. Important content in an image is found through "EnergyFunction". Low values are deleted before high values. Seams are found by a simple dynamic programming algorithm with a unit neighborhood.
The following options can be given:
|"ProtectionMask"||None||mask that protects the content given in the mask|
|"RemovalMask"||None||mask that tries to remove content of the mask first|
|"DirectionOrder"||"WidthHeight"||order of seam carving, either "WidthHeight" or "HeightWidth"|
|"EnergyFunction"||GradientFilter[#,1,Method→"ShenCastan"]&||function to apply to the image that gives an importance value to each pixel|
|Method||Automatic||valid options are "ForwardEnergy", "BackwardEnergy" and Automatic|
|"MaskMultiplier"||10.04||multiplier used for the masks|
The option "ProtectionMask" should be a binary image with the same dimensions as the image.
The option "RemovalMask" should be a binary image with the same dimensions as the image.
The option "EnergyFunction" should be a function that returns a grayscale image in which the most important parts are white and the least important parts black.
Using "EnergyFunction", an importance is specified for each pixel:
Continuous seams are found from top to bottom or left to right using a neighborhood of 1 that minimizes the energy. The first continuous seam from top to bottom is highlighted in red:
By removing seams iteratively, the size of the image can be resized.
A removal mask is ignored when extending an image.
Extending an image is done in the same order that is used when removing seams. Except for that, seams are added as the mean values of the neighbors.
Changing the width and height is done by first seam carving along either the width or the height and then by seam carving along the height or the width.
The Method "BackwardEnergy"
calculates the energy of the current image, then carves. "ForwardEnergy"
looks at the energy after carving.