Java OpenCV:如何在android中将检测到的人脸保存到SD卡位置?
当使用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
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();
}