Save an Face Detection
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);
}
see, if your AndroidManifest.xml contains
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Hi berak. It is written. But it is not saved. My code is wrong?
i don't think, your code is wrong, apart from
mRgba.submat(facesArray[i].clone());
probably should bemRgba.submat(facesArray[i]).clone();
.,(you probably want to clone the image, not the rect)does the directory exist ? (imwrite() won't create directories)
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...