Documentation
¶
Overview ¶
Package perspective is used for creating and applying perspective transforms with the help of two quadrilaterals. A perspective transform can be used to map each point of one quadrilateral to another, given the corner coordinates for the source and destination quadrilaterals.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Perspective ¶
type Perspective struct { // SrcPoints is an array of the corner coordinates of the source // quadrilateral. SrcPoints [8]float64 // DstPoints is an array of the corner coordinates of the destination // quadrilateral. DstPoints [8]float64 // Coeffs is a homographic transform matrix, expressed as an array of // coefficients. Coeffs [9]float64 // CoeffsInv is an inverse homographic transform matrix, expressed as an // array of coefficients. CoeffsInv [9]float64 }
func New ¶
func New(srcPoints, dstPoints [8]float64) *Perspective
New takes the corner coordinates of the source and destination quadrilaterals in a [x1, y1, x2, y2, x3, y3, x4, y4] form.
func (*Perspective) Transform ¶
func (t *Perspective) Transform(sx, sy float64) (dx, dy float64)
Transform maps a point from the source quadrilateral to the destination quadrilateral.
func (*Perspective) TransformInv ¶
func (t *Perspective) TransformInv(sx, sy float64) (dx, dy float64)
TransformInv maps a point from the destination quadrilateral to the source quadrilateral.
Click to show internal directories.
Click to hide internal directories.