Blobs.polarmatch#

Blobs.polarmatch(target: int) tuple[list[float], ndarray][source]#

Compare polar profiles

Parameters:

target (int) – the blob index to match against

Returns:

similarity and orientation offset

Return type:

ndarray(N), ndarray(N)

Performs cross correlation between the polar profiles of blobs. All blobs are matched against blob index target. Blob index target is included in the results.

There are two return values:

  1. Similarity is a 1D array, one entry per blob, where a value of one indicates maximum similarity irrespective of orientation and scale.

  2. Orientation offset is a 1D array, one entry per blob, is the relative orientation of blobs with respect to the target blob. The target blob has an orientation offset of 0.5. These values lie in the range [0, 1), equivalent to \([0, 2\pi)\) and wraps around.

Example:

>>> from machinevisiontoolbox import Image
>>> im = Image.Read('shark2.png')
>>> blobs = im.blobs()
>>> blobs.polarmatch(1)
([np.float64(0.9999999999999999), np.float64(0.9999999999999999)], array([0.5, 0.5]))

Note

  • Can be considered as matching two functions defined over \(S^1\).

  • Orientation is obtained by cross-correlation of the polar-angle profile.

Seealso:

polar contour