Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Rect rectCrop=null;

now, what will happen in your code, if it did NOT detect a face ? (your logic is broken there)

Rect rectCrop=null;

now, what it can and will happen in your code, if it did NOT detect a happen, that NO face ? (your logic is broken there)will be detected. you have to take care for this:

//only write an image IF we have a valid rect !
if (rectCrop != null) {
  Mat image_roi = new Mat(image,rectCrop);
  Imgcodecs.imwrite("C:\\cropimage_912.jpg",image_roi);
}