Object-recognition using multiple templates in python
Changed licence to MIT for easier integration with other projects
Minor version that throws a more explicit error message when providing 0-width or height image or template.
Also added pip install matplotlib
to tutorial notebooks since not an dependency of MTM.
Provide faster search with mulitple templates by parallelizing the search -> PR by @bartleboeuf (thanks !)
Update internal NMS code to work with latest OpenCV, and force opencv version to min 4.5.4, Fix #14
The version fixes issue with the latest version of opencv (4.5.4, maybe before)), for which cv2.NMSBoxes
return an array of different shape.
Just by limiting the version of OpenCV to max 4.3.0.
Next release of MTM will be modified to use the latest version of OpenCV.
As suggested in issue #11, the size of the template is checked before any computation to make sure they fit in the search region or image.
Also updated requirements and packaging (pyproject.toml)
The comparison of the pixel values can be limited to a fraction of the template by providing an associated mask image, which should have the same dimension than the template.
To do so the tuple for a given template should be
("label", template_array, mask_array)
using a mask is only possible with method 0/TM_SQ_DIFF (not compatible with the Non-Maxima suppression though) and 3/TM_CCORR_NORMED
using a mask is optional (and not always beneficial)
the previous format
("label", template_array)
is still acceptable and within the list of templates, some can have a mask while other not.
See new tutorial with mask.
See release note for 1.5.3.post2
matchTemplates
)This version replaces the original hard-coded NMS with the opencv cv2.dnn.NMSBoxes
method.
This simplifies the code and improve portability to other programing languages.
Performance-wise it is similar to potentially slightly faster.
The function signature is the same except the default scoreThreshold is now 0.5
Other changes:
MTM.NMS
PointInRect
and computeIoU
have been removed (not used anymore for NMS)