Qualeams / Android-Face-Recognition-with-Deep-Learning-Library

Face Recognition library for Android devices is an Android library (module) which includes several face recognition methods.
Apache License 2.0
371 stars 135 forks source link

Lacks comments #4

Closed Zumbalamambo closed 7 years ago

Zumbalamambo commented 7 years ago

Document the code and add comments wherever necessary

Zumbalamambo commented 7 years ago

Is it possible to get real world height and width of face from the bound rect thats drawn around face?

sladomic commented 7 years ago

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)

Zumbalamambo commented 7 years ago

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?

sladomic commented 7 years ago

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/

Zumbalamambo commented 7 years ago

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... :(

sladomic commented 7 years ago

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..

Zumbalamambo commented 7 years ago

Ya Im having hard time in doing so.. wondering how they measure it in mtailor app

Zumbalamambo commented 7 years ago

In our Library, in case if I have to remove a person from memory, how will i remove?

Zumbalamambo commented 7 years ago

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..

sladomic commented 7 years ago

@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.

sladomic commented 7 years ago

Oops :)

Zumbalamambo commented 7 years ago

okay sure.. i have to find how to push and open pull request . :) Im new to all these hehehe

Zumbalamambo commented 7 years ago

Have you ever tried background subtraction? it is not accurate if we use absdiff.

Zumbalamambo commented 7 years ago

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

Zumbalamambo commented 7 years ago

sorry...:( I did the same mistake.. pressed the bigger button instead of smaller one :)