2016-09-14 15:01:56 -0500 commented question Object Detection issue While using the CascadeClassifier::detectMultiScale, you can play around with the function arguments, particularly scale and size of the object detected. This should weed out small objects such as the leaf stem. Take a look here PS: The third image from the bottom right in your training set suspiciously resembles the falsely detected leaf stem in the sample test image you've provided, hence the misclassification. Adjusting the minSize argument in detectMultiscale might help fix this issue. 2016-09-14 14:30:31 -0500 answered a question crack detect red line opencv I recommend using Probabilistic Hough Transform - void HoughLinesP(InputArray image, OutputArray lines, double rho, double theta, int threshold, double minLineLength=0, double maxLineGap=0 ) vector lines; HoughLinesP(dst, lines, 1, CV_PI/180,33 ,1, 1 );  Now, lines contains the end points of the line segments detected by the Probabilistic Hough transform. If you want to know the length of the line segment (in pixels), you can calculate the distance between its end points. What berak means to say is that since cracks are detected as lines by Hough Transform, if you get lines.size() = 0 (i.e. the lines vector is empty), no cracks were found. 2016-09-14 14:19:37 -0500 answered a question Cropping a face and removing the background? Check out the Face detection module tutorial to detect the face. You should be able to directly apply it to extract the face (along with neck/torso and the surrounding background) as a Mat object. Are you using a camera with a stationary scene with faces popping in and out? In that case, subtracting a detected face from the background is quite straightforward. You will first need to save template background image Mat background_img without any faces in the scene. Once you detect a face as Mat roi , find and extract the corresponding sub-region in bgrnd_img to get roi_background_img. Now you can simply perform subtraction: roi - roi_background_img to get only the face (with the neck and parts of the torso). Note: This will produce poor results if your illumination varies. In this case, you should threshold both roi and roi_background_img before subtraction. Additionally, you can also check out this module for background subtraction. Let me know if this helps!