Darwin
1.10(beta)
|
Utility class for computing multiple template matches. More...
Public Member Functions | |
drwnTemplateMatcher () | |
default constructor | |
drwnTemplateMatcher (const drwnTemplateMatcher &tm) | |
copy constructor | |
void | clear () |
clears all templates and buffered storage | |
bool | empty () const |
returns true if there are no templates | |
int | size () const |
returns the number of templates | |
int | width () const |
returns the width of the largest template | |
int | height () const |
returns the height of the largest template | |
void | reset () |
release internal memory (keeps templates) | |
void | addTemplate (cv::Mat &t) |
Add templates to the object. The difference between addTemplate and copyTemplate is that the former takes does not make a copy so changes by the calling function will be corrupt the data. Templates should be single channel 32-bit floating point. | |
void | addTemplates (vector< cv::Mat > &t) |
See above. | |
void | copyTemplate (const cv::Mat &t) |
See above. | |
void | copyTemplates (const vector< cv::Mat > &t) |
See above. | |
vector< cv::Mat > | responses (const cv::Mat &img, int method=CV_TM_CCORR) |
Response images are all generate to be the same size as the original image. Boundaries are zero-padded. Caller is responsible for freeing memory. Functions without image argument use the previously loaded image. | |
vector< cv::Mat > | responses (int method=CV_TM_CCORR) |
See above. | |
cv::Mat | response (const cv::Mat &img, unsigned tid, int method=CV_TM_CCORR) |
See above. | |
cv::Mat | response (unsigned tid, int method=CV_TM_CCORR) |
See above. | |
drwnTemplateMatcher & | operator= (const drwnTemplateMatcher &tm) |
assignment operator | |
const cv::Mat & | operator[] (unsigned i) const |
returns the i-th template | |
Protected Member Functions | |
void | cacheDFTAndIntegrals (const cv::Mat &image) |
caches all buffered data for a given image | |
Protected Attributes | |
vector< cv::Mat > | _templates |
vector of templates to match | |
vector< pair< double, double > > | _templateStats |
template mean and energy | |
cv::Size | _largestTemplate |
dimensions of the largest template | |
cv::Size | _imgSize |
size of image being buffered | |
vector< cv::Mat > | _dftTemplates |
buffered templates in fourier space | |
cv::Mat | _dftImage |
buffered image in fourier space | |
cv::Mat | _dftResponse |
buffer for response image | |
cv::Mat | _imgSum |
buffer for integral image | |
cv::Mat | _imgSqSum |
buffer for integral square image | |
Utility class for computing multiple template matches.
The instantiated object pre-computes template (and image) DFTs to allow for faster matching on multiple images (of the same size). However, the code is very memory intensive. Call the drwnTemplateMatcher::reset function to release the internal buffers.