|
std::vector< utils::Rect > ICLCV_API | matchTemplate (const core::Img8u &src, const core::Img8u &templ, float significance, core::Img8u *buffer=0, bool clipBuffersToROI=true, RegionDetector *rd=0, bool useCrossCorrCoeffInsteadOfSqrDistance=false) |
| template matching using proximity measurement More...
|
|
std::vector< utils::Rect > ICLCV_API | matchTemplate (const core::Img8u &src, const core::Img8u *srcMask, const core::Img8u &templ, const core::Img8u *templMask, float significance, core::Img8u *srcBuffer=0, core::Img8u *templBuffer=0, core::Img8u *buffer=0, bool clipBuffersToROI=true, RegionDetector *rd=0, bool useCrossCorrCoeffInsteadOfSqrDistance=false) |
| more general matchTemplate implementation More...
|
|
std::ostream & | operator<< (std::ostream &s, const LineSegment &l) |
| ostream operator for the line-segment type More...
|
|
std::ostream & | operator<< (std::ostream &str, const WorkingLineSegment &ls) |
| Overloaded ostream-operator for WorkingLineSegment-instances. More...
|
|
template matching using proximity measurement
Overview
This function matches the given template and returns all rects where the template is found with at least the given significance. The significance value must be specified in range [0,1] whereby significance levels lower then 0.5 involve as a rule too many results.
Algorithms
Template matching is performed by the following steps
- create a proximity-map of all channels of the src image with the according channels in the template image (result is buffered in the optionally given image buffer) Range of this map is [0,255]
- create a single channel binary image from the proximity-map using the following rule
- detect connected region in the binary map
- for each detected region with value 1, put a utils::Rect centered at the region center with size of the template (and cropped to the image rect) into the result list
- return the result list
Benchmarks:
I applied some exemplary Benchmarks on a 2GHz Core2Duo with the following results:
- source image size 640x480, template size 100x100, 3-channel RGB image
about: 37ms
- source image size 640x480, template size 100x100, 1-channel gray image
about: 13ms
- source image size 640x480, template size 10x10, 3-channel RGB image
about: 25ms (not much faster)
- source image size 640x480, template size 200x200, 3-channel RGB image
about: 35ms (faster than 100x100 because of more omitted border pixels)
The internally used Ipp-Function uses several Threads to apply the proximity measurement call, which means that the function might become much slower on a single core machine.
- Parameters
-
src | source image where the template should be found in |
templ | template to search int the src image |
significance | significance level in range 0,1 |
buffer | temporary image buffer (this buffer can be given to the function optionally) if given this buffer is exploited internally. The buffers size and channel count |
clipBuffersToROI | are adapted automatically |
rd | Optionally exploited ImgRegionDetector object pointer. If given, this region detector is used, which can speed up Performance in successive calls to matchTemplate |
useCrossCorrCoeffInsteadOfSqrDistance | |