簡體   English   中英

OpenCV:如何將檢測到的面部保存到android中的SD卡位置?

[英]OpenCV: How to save detected face to SD Card location in android?

當使用OpenCV檢測到Face時,有人可以建議我如何將圖像文件保存到Android中的SD卡位置。

使用這樣的東西將mat轉換為位圖:

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();
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM