Closed Zumbalamambo closed 7 years ago
Is it possible to get real world height and width of face from the bound rect thats drawn around face?
No, you would need to use another detector for facial features I guess. But you could try it out with the code you already have (e.g. OpenCV CascadeClassifier)
Okay thank you... It appears to be bit hard... It depends on the focal distance... If the focal distance changes, the measurement varies... Also the angle of the plane upon which the mobile is resting has got a significant effect on measuring real world dimensions of face or any object that has to be measured.. Do you have any idea about getting real world measurements?
I don't see any easy solution for this and you would need to have a reference object to calibrate (e.g. a CD, since this is common and everyone has one at home).
Here's a tutorial which demonstrates measurement using OpenCV http://www.pyimagesearch.com/2016/03/28/measuring-size-of-objects-in-an-image-with-opencv/
I tried whats in pyimagesearch. It works sometimes but if i vary the distance of the camera from the object being measured, the width varies too... :(
I think that's really a problem. For that I think you would need 2 cameras so you could also measure the distance. But maybe you can find an algorithm for measuring the distance and then adjust the width/height..
Ya Im having hard time in doing so.. wondering how they measure it in mtailor app
In our Library, in case if I have to remove a person from memory, how will i remove?
I have a suggestion. Instead of initialising opencv in all activities, you can initialise in Application class once and use it throughout the app life cycle as follows,
public class SampleInit extends Application {
@Override
public void onCreate() {
super.onCreate();
if(!OpenCVLoader.initDebug()){
}
}
}
Then in your AndroidManifest.xml
, you can include the above class file within <application tag as android:name=".SampleInit".
Failing to mention it in manifest file will crash by the way..
@Zumbalamambo if you want to remove a person you need to delete the folder in the file system (e.g. /sdcard/Pictures/facerecognition/training/Michael)
Yes, that's a good input with the Application class. If you already implemented and tested it you can open a pull request and I can merge it into the library.
Oops :)
okay sure.. i have to find how to push and open pull request . :) Im new to all these hehehe
Have you ever tried background subtraction? it is not accurate if we use absdiff.
so I tried using alpha blending as in learn open cv
//Convert bitmap to mat
Utils.bitmapToMat(foregroundBitmap, foreground);
Utils.bitmapToMat(backgroundBitmap, background);
Utils.bitmapToMat(alphaBitmap, alpha);
// Convert Mat to float data type
foreground.convertTo(foreground, CV_32FC3);
background.convertTo(background, CV_32FC3);
// Normalize the alpha mask to keep intensity between 0 and 1
alpha.convertTo(alpha, CV_32FC3, 1.0/255);
// Storage for output image
Mat ouImage = Mat.zeros(foreground.size(), foreground.type());
// Multiply the foreground with the alpha matte
multiply(alpha, foreground, foreground);
multiply(1.0-alpha, background, background);
add(foreground, background, ouImage);
but then it throws an error like following
Error:(62, 21) error: bad operand types for binary operator '-' first type: double second type: Mat
Can you please help me to sort this? How do I subtract a mat from scalar
sorry...:( I did the same mistake.. pressed the bigger button instead of smaller one :)
Document the code and add comments wherever necessary