Documentation ¶
Overview ¶
Package pmatch implements image patch matching and search. For most functionality, there are three different implementations:
1. Naive Go implementation - rather slow, but hopefully correct 2. Slightly optimized Go version 3. Cgo version - fastest
Index ¶
- func LoadTestImg() *image.YCbCr
- func ScoreRGBACosSlow(img, pat *image.RGBA, offset image.Point) (cos float64)
- func SearchRGBA(img, pat *image.RGBA) (maxX, maxY int, maxCos float64)
- func SearchRGBAC(img, pat *image.RGBA) (int, int, float64)
- func SearchRGBASlow(img, pat *image.RGBA) (maxX, maxY int, maxCos float64)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadTestImg ¶
LoadTestImg returns a test image to be used for tests and examples. Image data is embedded in the binary, which makes it easy to copy around test/example binaries. Always returns a newly allocated image.
func ScoreRGBACosSlow ¶
ScoreRGBACosSlow computes the cosine similarity score for an (RGBA) patch on an (RGBA) image. This a slow implementation useful as ground truth for testing. The alpha channel is ignored.
func SearchRGBA ¶
SearchRGBA searches for the position of an (RGBA) patch in an (RGBA) image, using cosine similarity. Slightly optimized implementation. Panics (due to out of bounds errors) if the patch is larger than the image in any dimension. The alpha channel is ignored.
func SearchRGBAC ¶
SearchRGBAC searches for the position of an (RGBA) patch in an (RGBA) image, using cosine similarity. Implemented in Cgo. Panics if the patch is larger than the image in any dimension. The alpha channel is ignored.
func SearchRGBASlow ¶
SearchRGBASlow searches for the position of an (RGBA) patch in an (RGBA) image, using cosine similarity. This a slow implementation useful as ground truth for testing. Panics (due to out of bounds errors) if the patch is larger than the image in any dimension. The alpha channel is ignored.
Types ¶
This section is empty.