LocateSingleObject_SAD


Finds a single occurrence of a predefined template on an image by analysing the Square Average Difference between pixel values.

Applications:Almost always inferior to NCC, so rarely used in real applications.

Syntax

C++
C#
Python
 
def LocateSingleObject_SAD(
	inImage: Image,
	inGrayModel: GrayModel,
	/,
	*,
	inSearchRegion: ShapeRegion | None = None,
	inSearchRegionAlignment: CoordinateSystem2D | None = None,
	inMinPyramidLevel: int = 0,
	inMaxPyramidLevel: int | None = 3,
	inIgnoreBoundaryObjects: bool = False,
	inMaxDifference: float = 0.0,
	outAlignedSearchRegion: ShapeRegion | None = None
)
-> (
	outObject: Object2D | None,
	outPyramidHeight: int,
	diagImagePyramid: list[Image],
	diagMatchPyramid: list[Image],
	diagScores: list[float] | None
)

Parameters

Name Type Range Default Description
Input value inImage Image Image on which model occurrence will be searched
Input value inSearchRegion ShapeRegion | None None Possible centers of the object occurrence
Input value inSearchRegionAlignment CoordinateSystem2D | None None Adjusts the region of interest to the position of the inspected object
Input value inGrayModel GrayModel Model which will be sought
Input value inMinPyramidLevel int 0 - 12 0 Defines the highest resolution level
Input value inMaxPyramidLevel int | None 0 - 12 3 Defines the number of reduced resolution levels that can be used to speed up computations
Input value inIgnoreBoundaryObjects bool False Flag indicating whether objects crossing image boundary should be ignored or not
Input value inMaxDifference float 0.0 - 0.0 Maximum accepted average difference between pixel values
Output value outObject Object2D | None Found object
Output value outPyramidHeight int Highest pyramid level used to speed up computations
Output value outAlignedSearchRegion ShapeRegion | None None Transformed input shape region
Diagnostic input diagImagePyramid list[Image] Pyramid of iteratively downsampled input image
Diagnostic input diagMatchPyramid list[Image] Locations found on each pyramid level
Diagnostic input diagScores list[float] | None Scores of found match on each pyramid level

Hardware Acceleration

This operation supports automatic parallelization for multicore and multiprocessor systems.