Save an Face Detection

asked 2015-10-23 03:09:10 -0600

synome gravatar image

updated 2015-10-23 03:10:17 -0600

Hi all!!!

Sorry...I can't English.(Using Google Translation)

I want to save in the detection window as an image from the movie by using the Face Detection of OpenCV sample program.

1)Run the application and error does not occur

2)It can not be saved image in the detection window

3)Even stored, stores the same image in a large amount or app is shutdown feel uneasy.

Is there a solution for this problem?

Please help me.

Thanks for reading.

My code is follow.

    Rect[] facesArray = faces.toArray();
    for (int i = 0; i < facesArray.length; i++){
        Core.rectangle(mRgba, facesArray[i].tl(), facesArray[i].br(), FACE_RECT_COLOR, 3 );

    File mediaStorageDir = new File(
             Environment.getExternalStorageDirectory().getPath() + "/DCIM/100ANDRO/");
        Mat face = mRgba.submat(facesArray[i].clone());
        Highgui.imwrite(mediaStorageDir + Integer.toString(i) + ".jpg", face);
    }
edit retag flag offensive close merge delete

Comments

1

see, if your AndroidManifest.xml contains

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

berak gravatar imageberak ( 2015-10-23 03:15:26 -0600 )edit

Hi berak. It is written. But it is not saved. My code is wrong?

synome gravatar imagesynome ( 2015-10-25 20:05:34 -0600 )edit

i don't think, your code is wrong, apart from mRgba.submat(facesArray[i].clone()); probably should be mRgba.submat(facesArray[i]).clone();.,(you probably want to clone the image, not the rect)

does the directory exist ? (imwrite() won't create directories)

berak gravatar imageberak ( 2015-10-26 02:38:21 -0600 )edit

Hi berak. After removing the .clone() it was saved! But...It does not appear in the gallery ... why? And...while it has been detected, not only partially saved. When you do not know what is stored. Image also becomes rough. It is full of problems...

synome gravatar imagesynome ( 2015-10-27 20:42:46 -0600 )edit