我正在尝试数学任何由我的相机捕获的随机图像。我想在它们之间进行比较,我想给出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");
}