![]() ![]() InputStream inputStream = new ByteArrayInputStream(bytes.toArray()) When we input our source image, we should now receive the output image with all the faces marked with a red rectangle: 7. Imgproc.rectangle(loadedImage, face.tl(), face.br(), new Scalar(0, 0, 255), 3) This is the number of neighbors a candidate rectangle should have in order to retain it.įinally, we'll loop through the faces and save the result: Rect facesArray = facesDetected.toArray() Int minFaceSize = Math.round(loadedImage.rows() * 0.1f) ĬascadeClassifier.load("./src/main/resources/haarcascades/haarcascade_frontalface_alt.xml") ĬtectMultiScale(loadedImage,Ībove, the parameter 1.1 denotes the scale factor we want to use, specifying how much the image size is reduced at each image scale. Next, we need to initialize the CascadeClassifier to do the recognition: CascadeClassifier cascadeClassifier = new CascadeClassifier() Then, we'll declare a MatOfRect object to store the faces we find: MatOfRect facesDetected = new MatOfRect() Mat loadedImage = loadImage(sourceImagePath) ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |