0

Currently learning opencv in Python. I want to do some image/pixel analysis with the screen.

With opencv/python, I wonder if there is a way to capture the visual content of a window of another software.

For example if I start a game in a window, I want opencv or python to capture the pixel content of that game window and run analysis for that content.

In the same fashion, if I play a fullscreen video with a video player, I would also like to capture the pixel content of the fullscreen and run analysis for that content with opencv/python.

I am not sure if opencv is the best way to do this. If you have suggestions for more suitable libraries, please let me know. Thank you.

user2526586
  • 972
  • 2
  • 12
  • 27
  • What do you mean by "pixel content"? Do you want to detect a specific shape? Do you want to detect the border of your application? – T A Aug 17 '18 at 06:30
  • Yes, that kind of operations. Like detecting edges, gradients of shades, etc... Why? Do you have a better suggestions? – user2526586 Aug 17 '18 at 06:35
  • This is rather general. Yes, you can use OpenCV to detect edges/gradients/shades. If the question is if OpenCV can solve this the answer is yes. I was wondering if you have a specific problem. – T A Aug 17 '18 at 06:39
  • But my question is how to capture the display of the window of another application. I know OpenCV can do those and that's why I am using OpenCV. – user2526586 Aug 17 '18 at 07:13
  • Okay, I get it now. You can grab the display of a video or application and process the contents using OpenCV. I have linked you a solution to both applications below. See if that will solve your problem. – T A Aug 17 '18 at 09:22

1 Answers1

0

For your second use case (capture a video frame) you could use the OpenCV Video Capture Feature. You can essentially open an .avi file and do operation on different frames.

If you want to grab the contents of a specific application you could do so in a similar fashion as already described in this answer. All you need to know is the specific position of your application window where you want to extract your information from.

T A
  • 1,677
  • 4
  • 21
  • 29