The code shown above does the following :
-
It loads the native OpenCV library so that we can use it using Java API.
-
We create an instance of CascadeClassifier passing it the name of the file from which the classifier is loaded.
-
Next we convert the image to a format which the Java API will accept using the Highui class. Mat is the OpenCV C++ n-dimensional dense array class.
-
Then we call the detectMultiScale method on the classifier passing it the image and MatOfRect object. After processing, the MatOfRect will have face detections.
-
We iterate over all the face detections and mark the image with rectangles.
-
Finally, we write the image to the output.png file.
Read full article from Day 12: OpenCV--Face Detection for Java Developers – OpenShift Blog
No comments:
Post a Comment