- C++ compiler
- OpenCV 3.0 and above
Command to compile code face_detection.cpp:
$ g++ -ggdb `pkg-config --cflags opencv` -o `basename face_detection.cpp .cpp` face_detection.cpp `pkg-config --libs opencv`
Command to run code face_detection.cpp:
./face_detection oscarSelfie.jpg
This problem code uses Haar features based cascade classifier, which has pre trained xml file which is used in this code to detect human face and eyes. Training a classifier needs a lot of positive and negative images. The steps in which code works is given below:
- loading pretrained xml file containing features of face and eyes
- creating cascade classifier for face and eyes
- detect face using classifier
- for each detected face detect eyes in it
- display the result
Input Image
Output Image
Command to compile code face_detection.cpp:
$ g++ -ggdb `pkg-config --cflags opencv` -o `basename jellyfish_detection.cpp .cpp` jellyfish_detection.cpp `pkg-config --libs opencv``
Command to run code face_detection.cpp:
$ ./jellyfish_detection jellyfish.jpg
This code deals with detection of jelly fish there are two ways I can think of either to train a classifier to detect jellyfish or to search for correlated homogeneous region in neighbourhood. This code uses the second option to detect jellyfish, it uses blob detection algorithm to calculate similar or homogeneous regions in the given area bound. Certain parameters needs to be tuned to increase the accuracy of the detection like setting threshold for minimum and maximum area. Steps in which code executes are:
- setting default parameters for blob detection
- setting minimum and maximum area threshold
- defining descriptor for blob
- detecting key points as centroid of jellyfish
- detecting jellyfish
- displaying the resultant image
Input Image
Output Image