Detecting people from above with opencv - opencv

I am using the HOG descriptor, with the default people detector from opencv in python to try detecting people from above. The camera is positioned over a corridor and the descriptor from opencv doesn't have a very good performance, since it doesn't detect people very well and sometimes tracks some painings on the walls. Can anyone help me in understanding how to improve the performace?

Related

How many people in a FaceBook Profile Picture?

So I want to count how many people appear in a facebook profile picture.
Typically there are 0-2 people (sometimes there are 4-5+ but that's more rare).
A sample dataset (and a few tries using python) can be found here:
https://github.com/yoniker/FaceDetect
I've tried different methods, none of them give reasonable results (all of those methods are wrong most of the time),I've tried the following:
-Face detection- http://docs.opencv.org/trunk/d7/d8b/tutorial_py_face_detection.html
It usually doesn't find anyone (that happens at around 75% of the pictures)- and I have tried different Haar filters and parameters.
-Pedestrian Detection http://www.pyimagesearch.com/2015/11/09/pedestrian-detection-opencv/
Again it doesn't find people most of the time.
OpenFace:Probably this face recognition algo doesn't truly help with face detection (see https://groups.google.com/forum/#!topic/cmu-openface/X6erXKckk0Q).
And finally I've looked at different StackOverflow questions such as
Count the number of people in the video but none of them are relevant!
I've tried for half a day now- so help will be super appreciated!!
For me, dlib has given better results than using OpenCV's haar face detector. It has python bindings too. You can find quick-start code to do face detection here.
It would be possible to help better if you post an Image in which faces are not detected properly.
Having said that, to improve face detection apart from using dlib, you can experiment with these ideas:
Use histogram equalisation(equalizeHist on opencv) on gray scale image before passing it to face detector. (i.e preprocess your images)
If faces are tilted to left or right, more often face detection fails. To solve this rotate the images in steps of 5 degrees upto 30 degrees and apply face detection. At each rotation you might detect new faces.
Most face detectors which are not using deep learning detect mostly frontal faces. Not much could be done about this apart from using deep learning or train your own side profile face detector using HOG or HAAR features.
Hope this helps you to improve your face detection.
There's always the cascade classifier in OpenCV for all your face detection needs. If you could feed it with some nice features it would give you all the results.

Best Machine learning algorithm to detect fire in OpenCV

I need to code a fire detector using OpenCV and Ive been googling for days on what to use but failed. Everything I find in google is all about haar detecting rigid objects especially face
What is the best ML to detect fire? I have to use a ML algorithm, that means no Haar or Viola algorithms.
Any suggestions for this? and if possible can explain why that certain algorithm is applicable in detecting fire
Better if you consider it as machine vision problem rather than computer vision problem. Instead of using RGB camera, its better to go for RGB-IR camera.
Infrared cameras are sensitive to heat content in scene. When you use IR camerasm with simple algorithms or mere thresholding you can detect fire in scene in case of dark environment.
Cheap RGB-IR cameras are available online like Raspberry Pi's Pi-Noir camera or you can convert your camera to RGB-IR camera by removing IR protection film.

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.

OpenCV 2.4.3 FaceRecognizer doesn't recognize my face

I'm using cv::FaceRecognizer(EigenFaceRecognizer) to recognize my face.
I input 10 images of my face (which is photographed only my face. Not a background and size is 70x70, format is pgm) to train the recognizer.
Then try to predict exactly same photos that I used in training with Face CascadeClassifier and the Recognizer. But none of the photos are recognized as me!
Is there anything wrong?
Yes you are probably doing something wrong, or maybe your input photos are too similar.
You should start with one of the tutorials on using FaceRecognizer, such as in the OpenCV official tutorials or Chapter 8 of the book "Mastering OpenCV". And then to improve your recognition accuracy, follow the recommendations at "http://www.answers.opencv.org/question/15362/opencv-and-face-recognition/" and "http://www.answers.opencv.org/question/5651/face-recognition-with-opencv-24x-accuracy/".
And for further questions about OpenCV, you should post them on "answers.opencv.com" instead of StackOverflow, since that site has official support!

Free Face Detection Algorithm for Video

I'm working on an application which needs to detect the location of a face in a video stream, using a web cam placed at desk height (and slightly off to the side of the user).
I've already implemented a version of OpenCV (using their Haar detection) and it works ok... the problem is that it tends to lose the position of the face if the user turns their head to the side (or looks up).
Since the webcam is sitting on the desk, it is tilted up at a 30 degree angle. The OpenCV detection algorithm is trained using fully frontal images, but not up-angle images like the ones I'm using. I know OpenCV also has a profile Haar file that can be used.. but from my research it seems that the results are quite mixed on profile detection. In addition, I don't really have control over the background or lighting of the image... so this sometimes also effects the efficacy of the OpenCV detection algorithm.
So, I guess what I'm asking is... are there other face detection algorithms (that are hopefully free, as this is part of my university research) that are better for detecting faces for this type of setup? It seems like some of the built-in webcams (for Macs and PCs) actually have fairly robust algorithms for detecting faces (and then overlaying cheesy cartoon images over the faces)... but they seem to work well regardless of background or lighting. Do you have any recommendations?
Thanks.
For research purposes, you can use the Haar cascades in OpenCV, things are different if you want to go commercial (in which case you need to consider LBP cascades instead). Just be sure to quote the Viola-Jones paper in your references.
To improve the results of face detection, you have several paths:
individual image detection: you can send rotated images to a frontal cascade to account for some variability without training your own cascade
individual image detection but more work) : train your own cascade in operating conditions closer to the ones of your app
stability in video streams (as in webcams & co.) : this is achieved by adding a layer of tracking around the face detection. Depending on your knowledge about this topic, you can use your own filter, have fun with OpenCV's particle or Kalman filter, implement a simple first or second order low pass filter on the face position or a PID tracker on the detected face...
Any of these tracking filters will enhance a lot your results when processing video streams.
Use CLM-framework for accurate realtime face detection and face landmark detection.
Example of the system in action: http://youtu.be/V7rV0uy7heQ
You may find it useful.

Resources