matcher.naive_template — Simple template matching¶
The matcher.naive_template module
New in version 0.1.0.
- autocnet.matcher.naive_template.pattern_match(template, image, upsampling=16, metric=<MagicMock name='mock.TM_CCOEFF_NORMED' id='139705832968928'>, error_check=False)[source]¶
Call an arbitrary pattern matcher using a subpixel approach where the template and image are upsampled using a third order polynomial.
- Parameters
template (ndarray) – The input search template used to ‘query’ the destination image
image (ndarray) – The image or sub-image to be searched
upsampling (int) – The multiplier to upsample the template and image.
func (object) – The function to be used to perform the template based matching Options: {cv2.TM_CCORR_NORMED, cv2.TM_CCOEFF_NORMED, cv2.TM_SQDIFF_NORMED} In testing the first two options perform significantly better with Apollo data.
error_check (bool) – If True, also apply a different matcher and test that the values are not too divergent. Default, False.
- Returns
x (float) – The x offset
y (float) – The y offset
strength (float) – The strength of the correlation in the range [-1, 1].
- autocnet.matcher.naive_template.pattern_match_autoreg(template, image, subpixel_size=3, max_scaler=0.2, metric=<MagicMock name='mock.TM_CCORR_NORMED' id='139705832962080'>)[source]¶
Call an arbitrary pattern matcher using a subpixel approach where a center of gravity using the correlation coefficients are used for subpixel alignment.
- Parameters
template (ndarray) – The input search template used to ‘query’ the destination image
image (ndarray) – The image or sub-image to be searched
subpixel_size (int) – An odd integer that defines the window size used to compute the moments
max_scaler (float) – The percentage offset to apply to the delta between the maximum correlation and the maximum edge correlation.
metric (object) – The function to be used to perform the template based matching Options: {cv2.TM_CCORR_NORMED, cv2.TM_CCOEFF_NORMED, cv2.TM_SQDIFF_NORMED} In testing the first two options perform significantly better with Apollo data.
- Returns
x (float) – The x offset
y (float) – The y offset
max_corr (float) – The strength of the correlation in the range [-1, 1].