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);
2 | No.2 Revision |
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);