How to calculate surface roughness in disparity map?
Hello!
I am developing small project connected with security. I created simple face detection/recognition and stereo matching. So i have disparity map of the face region.
The first disparity map belongs to real face, the second is photo of the face showed from the phone.
I want to determine where is real and where not. i think that for this propose can be used something like "surface roughness", but i cant figure out how to calculate it.
Please tell me the method can be used for calculate "surface roughness", or better way to do the same.
Thanks!
If you are using a stereo camera (I suppose so), you need to let the cameras be really close one to each other to see such differences. Try with a printed photo to compare against it first of all, to see if you can cheat the system. I think that the first result that you can see is that using real face you get different results: The nose is darker, the eyes are blacked. But Stereo matching even if can be used for that, is not intended for that kind of use. In fact, if you use a human puppy and if you exploit only the depth you can probably have the same result. So... is the focus of your project recognize faces only using disparity map?
@HYPEREGO. thank you for quick reply. I have implemented stereo vision using two cameras and SGBM. I am also implemented face detection and recognition using DNNs. Now, i want to add some extra feature. As i can see, the disparity map of real face is more rough than fake, and i want to try implement some protection using this. But i do not know siautable algoritm for this task. Maybe i misstake and this method cannot give enogh accuracy, but i am experementing.
You could try making a normalized histogram of depths over the whole image, or if you can somehow identify a face region or subface region (concentric circle regions?), histograms over those areas, normalize them, and look for some sort of interesting shape or metrics about the histogram curves. I'd think that the depths of a flat image of a face will have flat (linear) characteristics due to the correlations on a flat image, but the actual face will have bumps, You could also try using the depth maps to create contours based on lines across the image (slices down or across) and see how close (in a fuzzy logic way), they come to meeting the slice profiles of real faces. Beware glasses, beards, printed face masks, mannikins, pets, etc.
@opalmirror, thank you for useful tip! i could calculate the histograms and histogram of real and fake faces. And they are differ considerably. Histogram of real face as you said had bumps, and fake had nearly one high line. You can see the histograms here real and fake. But now i do not know the algorithm for estimate this difference programmatically. Can you show me any suitable method, or where i can find information about it, please.
Prostoi, I am sorry, this is an application area (not an opencv operational question). It's also not an area where I have not researched or have experience. I am unable to provide any detailed additional guidance. If it were me, I might try next: normalization of the global depth bias, face skew (face pitch, yaw. roll), scale (to standard size), maybe median filter, then comparison of depth data against known good and bad reference faces. Since you're more interested in classifying (is it a face? true/false) rather than grading (probability it might be a face or segmentation within the face area), this naturally leads to a Support-vector machine or CNN. Best of luck!
@opalmirror, thank you! I tried to find any opencvs or mathematical algorithm, but totally forget about SVM. I already have experience with it - i used SVMs for face recognition and i think that i easily can implement fake-detector using SVM. I will post answer with my result.