Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java OpenCV:如何在android中将检测到的人脸保存到SD卡位置?_Java_Android_Opencv - Fatal编程技术网

Java OpenCV:如何在android中将检测到的人脸保存到SD卡位置?

Java OpenCV:如何在android中将检测到的人脸保存到SD卡位置?,java,android,opencv,Java,Android,Opencv,当使用OpenCV检测到人脸时,有人能建议我如何将图像文件保存到Android中的SD卡位置吗 Bitmap bitmap = Bitmap.createBitmap(matWithFace.cols(), matWithFace.rows(), Bitmap.Config.ARGB_8888); Utils.matToBitmap(matWithFace, bitmap); 然后将其保存到文件中,如下所示: try { FileOutputStream out = new FileO

当使用OpenCV检测到人脸时,有人能建议我如何将图像文件保存到Android中的SD卡位置吗

Bitmap bitmap = Bitmap.createBitmap(matWithFace.cols(), matWithFace.rows(), Bitmap.Config.ARGB_8888);
Utils.matToBitmap(matWithFace, bitmap);
然后将其保存到文件中,如下所示:

try {
    FileOutputStream out = new FileOutputStream(filename);
    bitmap.compress(Bitmap.CompressFormat.PNG, 90, out);
    out.close();
} catch (Exception e) {
    e.printStackTrace();
}