Haar Cascade vs Hog Detection - opencv

I have been working around with OpenCV for few days now and I have a project where I should detect cars and humans from the sky.
So here are my inputs:
A moving camera in the sky (embedded on a quadcopter) which is gonna capture frames.
A set of objects I should detect (humans and cars)
And here are my output:
A detection of those objects outlined by a rectangle or some contours
Based on that, my question is as follows: Which one between Haar Cascade and Hog Detection would you recommend to do so and why? Or any else?
Many thanks for your answers

HOG is usually better for human detection, than Haar. I have only experience in this so I thought I'd give some input on that. However, the limitation of HOG is that the human must be within a "perfect" area on the screen. Too close, it won't detect the human. Too far, it won't detect the human.
I have had better luck with HOG than Haar. Haar gave me too many false positives.

I have been trying to use HAAR to detect human, and it turns out to give too many false positives. I think HAAR is only suitable for face or eye detection.
since your camera is in the sky, the human is pretty small in the image and got a whole body shape. HOG would be a better choice.

You need to change scale factor and minimum neighbours in HAAR cascade which is not same for all the image. So it's better to use HOG.

Related

best algorithm for face detection and pose estimation

I am looking for algorithms/publications on face detection. There are plenty in the web. But my scenario is somewhat specialized. I want to detect faces accurately in images taken by wearable devices (e.g. narrative clips), so there will be motion blur, and image quality will not be that good. I want to detect faces that are within 15 feet of the camera accurately. Next goal is to estimate the pose, primarily to find out if the person is looking toward the camera ( or better looking at the camera owner).
Any suggestion?
My go to for this would either be a deep-learning framework using convolutional layers for pixel classification, or K-means/ K-Nearest Neighbour algorithm.
This does depend on your data, however. From your post I am assuming that your data isn't labelled? meaning you are unable to feed in the 'truth' to the algorithm for classification.
you could perhaps use a CNN (convolutional neural network) for pixel classification (image segmentation) which should identify the location of a person. given this, perhaps you could run a 'local' CNN i a region close to the face identified to classify the region the body is located in as a certain pose.
This would probably be my first take on the problem but would depend on the exact structure of your data, and the structure of your labels (if you have any).
I have to say it does sound like a fun project!
I found OpenCV's Haar Cascades for Face Detection pretty accurate and robust for motion blur and "live" face recognition.
I'm saying that because I used them for implementing an Eye-Tracker in C++ with a laptop webcam (whose resolution was not excellent and motion blur was naturally always present).
They work in multiresolution and are therefore able to detect faces of any size, but you can easily tune them for your distance of interest.
They might not be your final optimal solution, but since they are already implemented and come with the OpenCV package, they could constitute a good starting point.

OpenCV: Refine Cascade Face Detection

I'm making system for emotion detection on Android mobile phone. I'm using OpenCV's Cascades (LBP's or Haars) to find face, eyes, mouth areas etc. What I have observed till now that accuracy isn't stable. There are situations where I can't find eye or I have "additional faces" in the background due to very slight change of light. What I wanted to ask is:
1) Is Haar Cascade more Accurate than LBP?
2) Is there any good method for increasing accuracy of detection? Like find face/eyes etc on binarized image, or use some edge detection filter, saturation, anything else?
you can try Microsoft API for face emotion detection ..i am trying in my project so..result is best..try this link
https://www.microsoft.com/cognitive-services/en-us/emotion-api
sometimes HAAR or LBP will not get a good enough result for a face detection system. if you want to get more good acc. i think you can try to using STASM
it base on opencv and using Haar to detect face and landmark. something others you can also try YOLO Face detection
if you want to build your own face detection system just base on Haar or LBP and make them get a good result, maybe you will need to using the LBP to find out the face faster and train a CNN model to get the last good result, it can make your system to detect faces in realtime. as i know, the SEETAFACE is using this way to make a realtime faces detection.

How do you cut a face out of an image?

I have been given an image with rgb channels. I only want to see the persons face. How would I do that? Are neural nets used for this? If so, are there existing data files from neural nets that have already done the processing?
Since your questions is tagged with OpenCV, I will assume that you are looking for a solution within this library.
The first step is to find the faces. For this, use one of the cascade object detectors that are available: either the Viola-Jones one or the LBP one.
OpenCV comes with cascades trained for face detection for each of these detectors.
Then, it depends if getting a bounding box is enough or not.
If you need something more accurate, then you can:
[coarse face] use a skin color detector inside the face bounding box to get a finer face estimate, binarize the image and finally close the face shape using morphological filtering;
[fine face contour] use something like a grabcut procedure to get a pixel-accurate contour. You can initialize the grabcut with borders of the bounding box as background and center part of the bounding box as foreground.
Not really sure what you want to do, but you can use Haar Classifier for face detection.
From then on, it should be easy to only display the face. While there are available classifiers online, you can try training your own classifier should you have the time. I have done classifiers on hand, face, eyes before and it have an impressive result.
Should you need more help on training classifier, etc, just comment here, I will try my best to assist you.
Face detection functionality is also available in the Computer Vision System Toolbox for MATLAB in the form of the vision.CascadeObjectDetector object.

Tracking Human Blob Associated with Face Detection

I realize this is a non-trivial task, but what's the most practical method of detecting a face, and then tracking the body associated with that face in a video with moving background?
Detecting a face is fairly simple with OpenCV's trained Haar cascade for the face. Unfortunately, OpenCV's trained Haar cascades for the human body are so inaccurate as to be effectively unusuable, so my thought was to use the face detector to determine roughly where the "person" is, and then use something like OpenTLD to dynamically "learn" what the person's body looks like and track that over frames. This should have the benefit of being able to handle a moving background, which most motion-tracking code in OpenCV currently doesn't seem to handle. The main downside is that OpenTLD is still quite new, and all the public implementations I've tested are very buggy and difficult to use.
Does this seem like a practical approach? Are there better ways?
If you are interested in human body detection/tracking rather than face detection, you should check people detection sample in the OpenCV. OpenCV contains a HoG descriptors and SVM classifier based people detector, which is actually one of the most successfull people detection algorithms available.

OpenCV - Haar classifier for long objects with different angles

I have used Haar classifier with OpenCV before succesfully. Unfortunately it seems to work only on square objects and fixed angles (i.e. faces). However I need to find "long" (rectangular) objects which have different angles (see sample input image).
Is there a way to train Haar classifier to find such objects? All I can find are tutorials for face recognition. Any other alternative approches?
Haar classifiers are known to work with rigid object only. You need a classifier for each of the view. For example, the side-face classifier in OpenCV doesn't work as good as front-face classifer(due to the reason being, side face has more variation in yaw-pitch-roll than front face).
There is no perfect way of answering your question.
However, in your case whatever you are trying to classify (microbes I suppose) are overlapping on each other. Its a complex issue. But, you can isolate the region where microbes occur (not isolate each microbe like a face).
You can refer fingerprint segmentation techniques that are known to enhance the ridges on a fingerprint (here in your case its microbe edges) from the background and isolate the image.
Check "ridgesegmentation.m" in the following page:
http://www.csse.uwa.edu.au/~pk/Research/MatlabFns/index.html

Resources