Question

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?

Was it helpful?

Solution

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.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top