0

我正在尝试对相机捕获的任何随机图像进行数学运算。我想对它们进行比较,我想给出 10 分的评分。

我正在使用它,但它不起作用:

     bMap1 = BitmapFactory.decodeFile("/sdcard/mahendra.jpeg");
     bMap2 = BitmapFactory.decodeFile("/sdcard/google.jpg");
     System.out.println(">>>>>>>>>>>"+bMap1+"and"+bMap2);

     //image.setImageBitmap(bMap);

     BitmapFactory.Options opt = new BitmapFactory.Options();
     opt.inPreferredConfig = Bitmap.Config.ARGB_8888;
     opt.inSampleSize = 5;


     int intColor1 = 0;
     int intColor2 = 0;
     for (int x = 0; x <  bMap1.getWidth(); x++) {
        for (int y = 0; y <  bMap1.getHeight(); y++) {
             intColor1 =  bMap1.getPixel(x, y);
             intColor2 = bMap2.getPixel(x, y); 
             //System.out.print(" ("+ x + ","+ y +") c:" + intColor1);   
        }
        String resultString = String.valueOf(intColor1);

     }
     //now calculate percentage difference
     double razlika = (((double)intColor1 - intColor2)/intColor2)*100;
     System.out.println(">>>>>>>>>>>>"+razlika);

      if(razlika<100)
      {
          System.out.println(">>>>>>>>Rating of your image is 1 out of 10");

      }
4

0 回答 0