1

I am capturing the screen using robot.screenCapture() and frame bufferedImage1. Again I am capturing desktop screen and frame bufferedImage2.

Could please tell me how to compare these 2 images (bufferedImage1 and bufferedImage2) pixel by pixel. If there is any difference, then how to frame the part that is different?

nhahtdh
  • 55,989
  • 15
  • 126
  • 162
mini
  • 855
  • 4
  • 15
  • 22

1 Answers1

1

Here's one way to do it:

  1. Compare the entire images, get the percentage of pixels that differ more than a threshold.
  2. Divide into quarters recursively, down to a certain size, and get the same percentage for each quadrant.
  3. Draw the frame around the quadrants that are a certain amount above the average difference. If you need square sections, use a single quadrant based on size and percent difference. Otherwise, you can combine more than one quadrant with large differences.
xpda
  • 15,585
  • 8
  • 51
  • 82
  • could you please tell me how to compare 2 images and get the percentage of pixels that differ more than a threshold. – mini Jan 18 '13 at 05:32
  • You can compare each image pixel by pixel using system.drawing.bitmap.getpixel. You can speed it up at the cost of precision by resizing the images to a smaller resolution before you start. – xpda Jan 18 '13 at 05:51