Object Recognition
Match Recognition
This component is an interface for all object recognition methods, for example Feature Matching or Template Matching based on OpenCV 3. This interface expects a Companion::Algorithm::Recognition::Matching object that represents a specific matching algorithm. To improve image processing results the images can be scaled to different dimensions. Optionally, a shape detection implementation can be attached to retrieve Regions of Interest (ROI) before applying the matching algorithm.
/**
* Match recognition constructor.
* @param matchingAlgo Matching algorithm to use, for example feature matching.
* @param scaling Scaling to resize an image. Default is 1920x1080.
* @param shapeDetection Shape detection algorithm to detect ROI's in images (if not set the whole image will be searched).
*/
MatchRecognition(PTR_MATCHING_RECOGNITION matchingAlgo,
Companion::SCALING scaling = Companion::SCALING::SCALE_1920x1080,
PTR_SHAPE_DETECTION shapeDetection = nullptr);
Image Hashing
Use the HashRecognition interface for image hash processing. This interface expects a fixed model size in pixels for searched model resizing. To detect regions of interest a shape detection must be set as well as a supported hashing algorithm, for example Local Sensitive Hashing (LSH).
/**
* Hash recognition constructor.
* @param modelSize Model size in pixels.
* @param shapeDetection Shape detection algorithm to detect ROI's.
* @param hashing Hashing algorithm implementation, for example LSH.
*/
HashRecognition(cv::Size modelSize,
PTR_SHAPE_DETECTION shapeDetection,
PTR_HASHING hashing);
Hybrid Recognition
A hybrid approach is implemented to use Image Hashing to search for image models in ROIs and further to verify the recognitions with a feature matcher.
/**
* Hybrid recognition constructor.
* @param hashRecognition Hash recognition to use.
* @param featureMatching Feature matching to verify recognized hashes.
* @param resize Resize image factor from 1 to 100 (in percent). 100 is equal to 100% of the original scale.
*/
HybridRecognition(PTR_HASH_RECOGNITION hashRecognition,
PTR_FEATURE_MATCHING featureMatching,
int resize = 100);
Code Examples
Code examples can be found in the CompanionSamples repository for CPU and Cuda usage.