a. Good feature and SURF
The two functions in which we are interested in this section are GoodFeaturesToTrack and extractSURF. They are both high level function that allow features detection and especially corners. The example below how how to use them in the most simple way but before some explanation about this functions.
- GoodFeaturesToTrack: This function is especially designed to do corner detection. By default it uses CornerMinEigenVal algorithm but you can change it to use CornerHarris (as seen above) by changing a parameter value. The main difference with the Harris algorithm is that you should specify the minimum distance between each point, the quality level and the number of corners to detect. So at some point it does automaticaly what has been done in the previous chapter with the Harris example.
- SURF: This alogrithm is also especialised in feature detection but provide more informations like the corner orientation.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
b. Face detection
Regarding all what we have done before, you can think that detect faces in a picture is quite hard, but it is in fact pretty easy with the HaarDetectObjects. This function take an XML file in argument that describe the feature to detect. Hopefully the OpenCV provide multiples xml files to detect features like the face, eyes, ear mouse or the nose. The usage of this function is straightforward and the example below show a program that blur the face on an image.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
<<Line Edge And Contours Detection | Home | Video IO and Sources>>