title: android compare 2 images and highlight difference
body: <p>2 Images will be provided. We need to find differences between them and highlight them.</p>
  
  <p>So far I have seen this <a href="https://stackoverflow.com/questions/25022578/highlight-differences-between-images">solution</a> in JAVA but as BufferedImage is not supported in android, I am unable to proceed further. I have come close to comparing pixels of 2 Bitmaps but facing issue ahead.</p>
  
  <p>I have also tried comparing pixels of two bitmap, but it highlights all the non-white colors</p>
  
  <pre><code>void findDifference(Bitmap firstImage, Bitmap secondImage)
  {
      if (firstImage.getHeight() != secondImage.getHeight() &amp;&amp; firstImage.getWidth() != secondImage.getWidth())
          Toast.makeText(this, "Images size are not same", Toast.LENGTH_LONG).show();
  
      boolean isSame = true;
  
      for (int i = 0; i &lt; firstImage.getWidth(); i++)
      {
          for (int j = 0; j &lt; firstImage.getHeight(); j++)
          {
              if (firstImage.getPixel(i,j) == secondImage.getPixel(i,j))
              {
              }
              else
              {
                  differentPixels.add(new Pixel(i,j));
                  secondImage.setPixel(i,j, Color.YELLOW); //for now just changing difference to yello color
                  isSame = false;
              }
          }
      }
      imgOutput.setImageBitmap(secondImage);
  }
  </code></pre>
  
  <p>Thanks in advance.</p>