java - How adjust tolerance level for OpenCV detection false positives? -
i'm developing system using opencv, detects objects haarcascades xml files. however, there many false detections. there way minimize false detections? part of code:
private void detecta(string arquivo) { cascadeclassifier bodydetector = new cascadeclassifier(path+arquivo); matofrect facedetections = new matofrect(); bodydetector.detectmultiscale(webcam_image, facedetections); // bodydetector.detectmultiscale(webcam_image, facedetections); (rect rect : facedetections.toarray()) { core.rectangle(webcam_image, new point(rect.x, rect.y), new point(rect.x + rect.width, rect.y + rect.height), new scalar(0, 255, 0));// mat2buf, mat2buf); } if (facedetections.toarray().length == 0) { toc.getlblsaida().settext(""); } else { //java.awt.toolkit.getdefaulttoolkit().beep(); toc.getlblsaida().settext(+facedetections.toarray().length + "objetos detectados"); try { playsound(); } catch (ioexception ex) { logger.getlogger(testwebcam.class.getname()).log(level.severe, null, ex); } }
}
there's couple of overloads detectmultiscale allow this.
i.e increasing value minneighbours [needed valid detection], , setting minsize , maxsize achieve, want.
Comments
Post a Comment