Android image comparison by pixel
<p>I am trying to Math any random image which is captured by my camera. I want to do comparision between them and I want to give rating of that out of 10.</p>

<p>I am using this but it is not working:</p>

<pre><code>     bMap1 = BitmapFactory.decodeFile("/sdcard/mahendra.jpeg");
     bMap2 = BitmapFactory.decodeFile("/sdcard/google.jpg");
     System.out.println("&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;"+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 &lt;  bMap1.getWidth(); x++) {
        for (int y = 0; y &lt;  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("&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;"+razlika);

      if(razlika&lt;100)
      {
          System.out.println("&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;Rating of your image is 1 out of 10");

      }
</code></pre>
