carver

package
v0.0.0-...-44dbb36 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2019 License: ISC Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const MaxEnergy = 1000.0

MaxEnergy is the default energy value used for borders (which would be otherwise undefined)

Variables

View Source
var (
	// ErrInvalid is thrown for invalid argument
	ErrInvalid = errors.New("invalid argument")
)

Functions

This section is empty.

Types

type ArrayCarver

type ArrayCarver struct {
	// contains filtered or unexported fields
}

ArrayCarver is a simple, array based implementation of seam carving.

func NewArrayCarver

func NewArrayCarver(img image.Image) (*ArrayCarver, error)

NewArrayCarver returns a new Carver for img

func (*ArrayCarver) Energy

func (a *ArrayCarver) Energy(x, y int) (float64, error)

Energy returns the current energy of the point at (x,y)

func (*ArrayCarver) HRemoveSeam

func (a *ArrayCarver) HRemoveSeam(seam []int) error

HRemoveSeam modifies the image, removing a horizontal seam

func (*ArrayCarver) HSeam

func (a *ArrayCarver) HSeam() ([]int, error)

HSeam returns the optimal horizontal seam of the image

func (*ArrayCarver) Height

func (a *ArrayCarver) Height() int

Height returns the current height of the image

func (*ArrayCarver) Img

func (a *ArrayCarver) Img() image.Image

Img returns the current image from the Carver

func (*ArrayCarver) VRemoveSeam

func (a *ArrayCarver) VRemoveSeam(seam []int) error

VRemoveSeam modifies the image, removing a vertical seam

func (*ArrayCarver) VSeam

func (a *ArrayCarver) VSeam() ([]int, error)

VSeam returns the optimal vertical seam of the image

func (*ArrayCarver) Width

func (a *ArrayCarver) Width() int

Width returns the current width of the image

type Carver

type Carver interface {
	Img() image.Image
	Height() int
	Width() int
	Energy(int, int) (float64, error)
	HSeam() ([]int, error)
	VSeam() ([]int, error)
	HRemoveSeam([]int) error
	VRemoveSeam([]int) error
}

Carver is an interface for seam carvers

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL