Story:
I have an app that is detecting faces build with opencv on iphone sdk 6.0 every thing is working i can use the front camer and the "back camera " also i can turn on/off the torch as well i can display how much fps i have at the moment (live) .
but now i want to add a additional feature that you can see how fare away is this face
are there some formulas or some good ideas or evan a solution from a pro ? (if you need some code or something i can show you every thing that you need )
Thx for help and fast answers !^^
hear is for every one a translation for objective c
-(double) faceDistance{
const NSInteger kFaceWidth = 10;
const NSInteger kPicWidth = 640;
CGPoint p1 = CGPointMake(10, 10);
CGPoint p2 = CGPointMake(100, 70);
int facePixelWidth;
int slope = (p2.y - p1.y) / (p2.x - p1.x);
double propOfPic = kPicWidth / facePixelWidth;
double surfSize = propOfPic * kFaceWidth;
double dist = surfSize / slope;
return dist;
}
I have update my code here is the solution for objective c