Ask Your Question

Revision history [back]

Screen Capture using X11 or any other library and use it in OpenCV

I am working on a project [ Creating an AI for playing chess ] in which I have to capture the whole screen or a particular window in real time. I saw a question in stack exchange about taking fast screenshots using X11 and using it in OpenCV QUESTION to display those screen shots. Unknowingly I started the project and now I am having a problem using at method to access pixels of the image captured.

Here's what I have to do:

  1. Capture the image of the screen [ Image of a chess board ]
  2. Break it into equal parts and detect the position of the chess pieces.
  3. Store these positions and puttext on the image captured and display it on the screen. [For detection purpose I have the images of the chess pieces which I cropped from the chess board. Each one of the chess piece have a size of 4747 pixels. Similarly the chessboard has a size of 474788 ]

Is there any way I can detect these chess pieces?

Links of the source files [ C++ ] : maya.cpp pieces.cpp pieces.h

Thanks in advance!

Screen Capture using X11 or any other library and use it in OpenCV

I am working on a project [ Creating an AI for playing chess ] in which I have to capture the whole screen or a particular window in real time. I saw a question in stack exchange about taking fast screenshots using X11 and using it in OpenCV QUESTION to display those screen shots. Unknowingly I started the project and now I am having a problem using at method to access pixels of the image captured.

Here's what I have to do:

  1. Capture the image of the screen [ Image of a chess board ]
  2. Break it into equal parts and detect the position of the chess pieces.
  3. Store these positions and puttext on the image captured and display it on the screen. [For detection purpose I have the images of the chess pieces which I cropped from the chess board. Each one of the chess piece have a size of 4747 pixels. Similarly the chessboard has a size of 474788 ]

Is there any way I can detect these chess pieces?

Links of the source files [ C++ ] : maya.cpp pieces.cpp pieces.h

example of pieces I want to detect : image description image description

The chessboard Image : image description

This chessboard is on the screen and I know the exact position of this board as I have set its position to Point(50,150) and what I did is iterating thru each squares with the help of their positions. I want my program to keep updates of the chess pieces and display it on the screen in real time.

Thanks in advance!