Detect forehead points using Dlib/python - python

Do we have any way to get points on the forehead of a face image?
I am using 68 points landmarks shape_predictor to get other points on the face but for this particular problem I need
points that are from the hairline to the center of the forehead.
Any suggestions would be helpful.

See this Github Repository: shape predictor with forehead coverage
I was looking for a forehead area detection when I came across this 81 point predictor.
With some simple co-ordinate geometry calculations you can get all the points you have been looking for.

you can use the tool provided with dlib called "imgLab" to train your own shape detector by performing landmark annotations

Related

How to change the face emotion with a single image?

I have a face image, and I found the 68 facial coordinate points with dlib libarary in python.
Now I want to change the face emotion by closing the mouth, for ex. remove the distance between points[61, 62,63,64,65,66,67,68,68], or closing the right eye by removing the distance between points:[43,44,..,48]
So, I need to to color this area with natural colors in a way that it seems natural.
is there any method or algorithm available to solve it? I use openCV right now,but any other library is okay for me, thanks.
What you could do is run your facial coordinate points detection algorithm on the images in this data set: https://datarepository.wolframcloud.com/resources/FER-2013, which contains images for seven emotions (happiness, neutral, sadness, anger, surprise, disgust, fear).
Like that you could maybe infer the transformation from the neutral face to one of this emotion.

What are the different types of face recognitions the dlib has?

Can i know what are all the face recognitions the dlib has to offer us. This is in the case of face landmarks.
There are many landmark detectors dlib has to offer us. Mostly, The first one is:
68-point landmark detectors: This pre-trained landmark detector identifies 68 points ((x,y) coordinates) in a human face. These points localize the region around the eyes, eyebrows, nose, mouth, chin and jaw.
The second one is:5 point landmark detector: To make things faster than the 68 point detector, dlib introduced the 5 point detector which assigns 2 points for the corners of the left eye, 2 points for the right eye and one point for the nose. This detector is most commonly used for alignment of faces.
There is a good article in gfg:Link
There is also another link : good explanation with examples.

how to do this disparity map in OpenCV

paper "Fast Obstacle Detection Using U-Disparity Maps with Stereo Vision"
reference paper: "Fast Obstacle Detection Using U-Disparity Maps with Stereo Vision"
I want to ask can opencv do this reslut?
How?
Thank you
Thanks for #Liew Xun's comment.
Input are left image and right image from two camera.(stereo camera)
I want to use opencv's cv2.StereoBM to do the result like the paper's image.
But,unfortunately i failed. I can't make the result like this paper's image.
So i am here to ask does anybody have the same experience do disparity map.
Can you give me a help or give me some advice?
What you are asking is a mobile robotics visual perception related question.
I guess this author made a trick on you as it is not called U disparity
The stereo depth can be computed by opencv stereo matching. If you fail, there could be many reason. you need to post what you have. you can follow this link to get depth map. https://docs.opencv.org/master/dd/d53/tutorial_py_depthmap.html
This right image is done by concatenating depth observation along the vertical plane. It is called V disparity. For normal road scene, most of the background road should be on the same straight line spam diagonally. Anything not on this line can be considered as an obstacle above or below the road surface. When the sensing distance is far, there might be deformation for the line because of stereo uncertainty. This algorithm is designed to detect cases such as negative obstacle(drains, potholes) and positive obstacle( cars humans)
you can find a sample implementation here
https://github.com/thinkbell/v_disparity
If you are Phd candidate, you need to read a lot more paper to know whether some paper is lying on their contribution rather than post question here and hope someone can tell you the answer.
Regards
Dr Yuan Shenghai

Normalise face landmark data using python

I am currently learning python and playing around with tensorflow.
I have a bunch of images where I have obtained the landmarks (pixel points) of a person's facial features such as ears and eyes. In addition, it also provides me with a box (4 coordinates) where the face exists.
My goal is to normalise all the data from different images into a standard sized rectangle / square and calculate the position of the landmarks relative to the normalised size.
Is there an API that allows me to do this already or should I get cracking and calculate the points myself?
Thanks in advance.
Actually I think I have figured it out, pretty simple maths actually, here is what i am going to do
Take every point and take away the first box point values - this will give me the points as if the box starts at [ 0,0 ]
Apply the box/normalised size ratio to every point

Horizontal and vertical edge profiles using python-opencv

I am trying to detect a vehicle in an image (actually a sequence of frames in a video). I am new to opencv and python and work under windows 7.
Is there a way to get horizontal edges and vertical edges of an image and then sum up the resultant images into respective vectors?
Is there a python code or function available for this.
I looked at this and this but would not get a clue how to do it.
You may use the following image for illustration.
EDIT
I was inspired by the idea presented in the following paper (sorry if you do not have access).
Betke, M.; Haritaoglu, E. & Davis, L. S. Real-time multiple vehicle detection and tracking from a moving vehicle Machine Vision and Applications, Springer-Verlag, 2000, 12, 69-83
I would take a look at the squares example for opencv, posted here. It uses canny and then does a contour find to return the sides of each square. You should be able to modify this code to get the horizontal and vertical lines you are looking for. Here is a link to the documentation for the python call of canny. It is rather helpful for all around edge detection. In about an hour I can get home and give you a working example of what you are wanting.
Do some reading on Sobel filters.
http://en.wikipedia.org/wiki/Sobel_operator
You can basically get vertical and horizontal gradients at each pixel.
Here is the OpenCV function for it.
http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=sobel#sobel
Once you get this filtered images then you can collect statistics column/row wise and decide if its an edge and get that location.
Typically geometrical approaches to object detection are not hugely successful as the appearance model you assume can quite easily be violated by occlusion, noise or orientation changes.
Machine learning approaches typically work much better in my opinion and would probably provide a more robust solution to your problem. Since you appear to be working with OpenCV you could take a look at Casacade Classifiers for which OpenCV provides a Haar wavelet and a local binary pattern feature based classifiers.
The link I have provided is to a tutorial with very complete steps explaining how to create a classifier with several prewritten utilities. Basically you will create a directory with 'positive' images of cars and a directory with 'negative' images of typical backgrounds. A utiltiy opencv_createsamples can be used to create training images warped to simulate different orientations and average intensities from a small set of images. You then use the utility opencv_traincascade setting a few command line parameters to select different training options outputting a trained classifier for you.
Detection can be performed using either the C++ or the Python interface with this trained classifier.
For instance, using Python you can load the classifier and perform detection on an image getting back a selection of bounding rectangles using:
image = cv2.imread('path/to/image')
cc = cv2.CascadeClassifier('path/to/classifierfile')
objs = cc.detectMultiScale(image)

Categories