簡體   English   中英

如何計算android中arcore的圖像質量分數?

[英]how to calculate the image quality score in arcore in android?

我想在將圖像添加到 ARCore 數據庫之前計算圖像質量分數。 我閱讀了arcoreimg google 文檔來計算質量分數,但他們正在Windows/Mac OS 命令行上計算分數。 我想在我的項目中以編程方式計算圖像質量分數。 我該怎么做。 請幫忙。 我也檢查了這個stackoverflow 鏈接,但沒有得到解決方案。 謝謝 :)

private void registeredImage() {

File file = new File(getExternalFilesDir(null) + "/db.imgdb");
//OutputStream outputStream = getResources().openRawResource(R.raw.imagedb);
Frame CurrFrame = frame;
Image currentImage;
int idx = -1;
byte[] data = null;

try {
    currentImage = CurrFrame.acquireCameraImage();


    data = NV21toJPEG(YUV_420_888toNV21(currentImage),
            currentImage.getWidth(), currentImage.getHeight());

} catch (NotYetAvailableException | IOException | ImageInsufficientQualityException e) {

    e.printStackTrace();
}

try {
    FileOutputStream outputStream = new FileOutputStream(file);
    Bitmap bitmap = BitmapFactory.decodeByteArray(data,0,data.length);

    -------------------------------------------------------------
    ***// Here i want to calculate the quality score of image that i'm going to add in database***.
    --------------------------------------------------------------
   
    idx = aid.addImage(name,bitmap);
    aid.serialize(outputStream);
    outputStream.close();
    
    Toast.makeText(this, "image Registered", Toast.LENGTH_SHORT).show();
} catch (IOException | ImageInsufficientQualityException e) {
    Toast.makeText(this, "Image doesnot have enough featues..Please try again", Toast.LENGTH_LONG).show();
    e.printStackTrace();
}

}

第一步:從官網下載arcoreimg工具

https://github.com/google-ar/arcore-android-sdk/blob/master/tools/arcoreimg/linux/arcoreimg

第 2 步:試試這個命令

./arcoreimg eval-img --input_image_path=yourImagePath

示例命令

./arcoreimg eval-img --input_image_path=/Users/ranjithkumar/Downloads/sceneform-android-sdk-1.15.0/samples/augmentedimage/app/src/main/assets/default.jpg

第 3 步:如果您遇到任何錯誤,請授予 arcoreimg 工具的讀+寫權限。

(如果第 2 步工作,請忽略此項)

sudo chmod +x arcoreimg

它返回 0 到 100 的分數。高分將起作用而不會滯后。

暫無
暫無

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

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