face-frontalization
face-frontalization copied to clipboard
Try demo with my own photo
Hi and thank you for this work. I tried demo.py on my computer and it works well. The I tried demo.py with a picture of myself (taken with my webcam) and the result is totally wrong. Any ideas ? :)
Hi @Justidan,
Well, it may happen. This code has a limit for face position it can frontalize. What I can suggest is that you plot the landmarks detected in your face, if the points lay in the correct position (eyes, nose, mouth, jaw) everything should work. You can also try different photos of different angles and occlusion to see what happens.
It is also important to note cases where there is more than one face in the image, it is necessary to frontalize on by one.
Hope it helps
The problem is that the facial landmarks are very good.
And I tried with different angles.
Let me show you :
That's really weird. Let me run some tests to see what is going on.
I have tested on your photo and it worked as expected. Which version of OpenCV are you using? Maybe there is some issue when calculating the camera matrix.
Hi, So it may be my set up :
cv2.version '3.1.0' dlib.version '18.18.100'
Maybe it is. Dlib 18.18 is known to work, but to be honest, I haven't tested on OpenCV 3.1, only on 2.4 and 3.0.
Ok thanks for this reply !
@Justidan,
I experienced an issue similar to yours. It happened because the face was small compared to the image size. I still don't know why this happens, hope to investigate this soon.
@dougsouza
Thanks for considering my issue.
I attach what i get with bigger face.
@dougsouza Do I have to preprocess the picture before using the frontalize code ? Like face detection, resize or something?
Yes, but that is already in the frontalization code. It is necessary to detect the face and pass the rectangle of the detection to the landmark detector, if you go through the code you'll see. If you reduce your photo and keep only your face, does it work better? You may also try to resize the whole to a smaller size to see what happens.
I did some preprocessing, here the results :
Ok, I tried as well with smaller pictures (the whole smaller) and it works much better ! Do you know if there is the same robustess issue in the original matlab code ? Thanks a lot
@Justidan,
I don't. In fact, I haven't used much the matlab code, also, using matlab is a little annoying when using dlib as a landmark detector since dlib runs in python. It is possible to use other detectors though, if you want to try, please refer to the original project page: http://www.openu.ac.il/home/hassner/projects/frontalize/
The code doesn't contain the crop and resize part. You need to do cropping and resizing according to the paper.