I have a project that detects head detection using CascadeClassifer
and tracking using Tracker lib in openCV. How to do an exclusive or(XOR) of void function? because I separated the detection from the tracking using void function. how will do that it will detects the head then it will start to track and if it starts tracking the detection will stop?
If you are using void CascadeClassifier::detectMultiScale(const Mat& image, vector<Rect>& objects, double scaleFactor=1.1, int minNeighbors=3, int flags=0, Size minSize=Size(), Size maxSize=Size())
to find objects in the image then you do not need to XOR the void value. The result of the detection is found in vector<Rect>& objects
. The detection was successful if the vector conatins any Rectangles.
If something is detected then you want the detection to stop and the result should be tracked. Doing an XOR like if(detection^tracking)
won't help you, because
I suggest that you add a boolean variable bool foundRectangle
to your class, which gets toggled btween true and false. It is false if you need a detection and is true if the detection found at least one rectangle, which should be tracked.
if(foundRectangle){
//track();
}
else {
//detect();
}