carve: github.com/aaparella/carve Index | Files

package carve

import "github.com/aaparella/carve"

Package carve implements the seam carving algorithm for dyanmic image resizing.

Index

Package Files

carve.go

func GenerateCostMatrix Uses

func GenerateCostMatrix(im image.Image) [][]float64

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 Uses

func GenerateEnergyMap(im image.Image) image.Image

GenerateEnergyMap applies grayscale and sobel filters to the input image to create an energy map.

func ReduceHeight Uses

func ReduceHeight(im image.Image, n int) (image.Image, error)

ReduceHeight uses seam carving to reduce height of given image by n pixels.

func ReduceWidth Uses

func ReduceWidth(im image.Image, n int) (image.Image, error)

ReduceWidth uses seam carving to reduce width of given image by n pixels.

func RemoveSeam Uses

func RemoveSeam(im image.Image, seam Seam) image.Image

RemoveSeam creates a copy of the provided image, with the pixels at the points in the provided seam removed.

type Point Uses

type Point struct {
    X, Y int
}

Point defines an X Y point in an image.

type Seam Uses

type Seam []Point

Seam defines a sequence of pixels through an image to be removed.

func FindLowestCostSeam Uses

func FindLowestCostSeam(mat [][]float64) Seam

FindLowestCostSeam uses a cumulative cost matrix to identify the seam with the lowest total cumulative energy.

func GenerateSeam Uses

func GenerateSeam(im image.Image) Seam

GenerateSeam returns the optimal horizontal seam for removal.

Package carve imports 5 packages (graph) and is imported by 1 packages. Updated 2017-03-26. Refresh now. Tools for package owners.