pmatch

package
v0.0.0-...-2538462 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: MIT Imports: 6 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadTestImg

func LoadTestImg() *image.YCbCr

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

func ScoreRGBACosSlow(img, pat *image.RGBA, offset image.Point) (cos float64)

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

func SearchRGBA(img, pat *image.RGBA) (maxX, maxY int, maxCos float64)

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

func SearchRGBAC(img, pat *image.RGBA) (int, int, float64)

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

func SearchRGBASlow(img, pat *image.RGBA) (maxX, maxY int, maxCos float64)

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.

Jump to

Keyboard shortcuts

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