Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

you can save the Mat from the face-detection straight away, without converting to Bitmap or such:

 Rect[] facesArray = faces.toArray();
 if (facesArray.length == 0)
        return;
 Rect found = facesArray[0];
 Mat img = mRgba.submat(found);

String folder = Environment.getExternalStorageDirectory().getPath() + "/ocv";
String fname = subDir.getAbsolutePath() + "/" + "face.png";
Highgui.imwrite(fname, img);

you can save the Mat from the face-detection straight away, without converting to Bitmap or such:

 Rect[] facesArray = faces.toArray();
 if (facesArray.length == 0)
0) // better safe, than sorry.
        return;
 Rect found = facesArray[0];
 Mat img = mRgba.submat(found);

String folder = Environment.getExternalStorageDirectory().getPath() + "/ocv";
String fname = subDir.getAbsolutePath() folder.getAbsolutePath() + "/" + "face.png";
Highgui.imwrite(fname, img);