Compare image to actual screen

后端 未结 4 1249
萌比男神i
萌比男神i 2021-01-16 23:03

I\'d like to make my Java program compare the actual screen with a picture (screenshot).

I don\'t know if it\'s possible, but I have seen it in Jitbit (a macro recor

4条回答
  •  日久生厌
    2021-01-16 23:34

    You can do this in two steps:

    1. Create a screenshot using awt.Robot

      BufferedImage image = new Robot().createScreenCapture(new Rctangle(Toolkit.getDefaultToolkit().getScreenSize()));
      ImageIO.write(image, "png", new File("/screenshot.png"));
      
    2. Compare the screenshots using something like that: How to check if two images are similar or not using openCV in java?

提交回复
热议问题