1 | initial version |
I have looked at the detectMultiScale
function; it has no mask parameter. In this case I would suggest you to create an image based on the mask you have and copy all the information you need from the input image into another one and detect on that image, where the image is just one colour, I think it is very fast the detection. I am saying something like:
cv::Mat imageToDetect;
inputImage.copyTo(imageToDetect, mask);
detector.detectMultiScale(imageToDetect, objects, 1.1, 3, 0, yourMinSize, yourMaxSize);
You can also do some kind of ROI (region of interest) of the important area like a boundingRect
of the contours of the important areas and do a for loop and detect on each imageToDetect(roi)
or inputImage(roi);
. In this case do not forget to add the x and y coordinate of the roi.