Package carve implements the seam carving algorithm for dyanmic image resizing.
- func GenerateCostMatrix(im image.Image) float64
- func GenerateEnergyMap(im image.Image) image.Image
- func ReduceHeight(im image.Image, n int) (image.Image, error)
- func ReduceWidth(im image.Image, n int) (image.Image, error)
- func RemoveSeam(im image.Image, seam Seam) image.Image
- type Point
- type Seam
func GenerateCostMatrix ¶
GenerateCostMatrix creates a matrix indicating the cumulative energy of the lowest cost seam from the left of the image to each pixel.
mat[x][y] is the cumulative energy of the seam that runs from the left of the image to the pixel at column x, row y.
func GenerateEnergyMap ¶
GenerateEnergyMap applies grayscale and sobel filters to the input image to create an energy map.
func ReduceHeight ¶
ReduceHeight uses seam carving to reduce height of given image by n pixels.
func ReduceWidth ¶
ReduceWidth uses seam carving to reduce width of given image by n pixels.
type Seam Point
Seam defines a sequence of pixels through an image to be removed.
func FindLowestCostSeam ¶
FindLowestCostSeam uses a cumulative cost matrix to identify the seam with the lowest total cumulative energy.