Chessboard Capture Program Users' Guide: Installation
Chessboard Capture Program Users' Guide: Installation
Installation
The program is found on https://sites.google.com/view/fredm/home . Just download
chessBoardCapture.zip unzip it to a folder of your choice. Installation does not update the registry, nor
any other files outside of the installation folder (except data files for which you specify the folder). To
uninstall the kit, just delete the folder you put it in.
This program only runs under Windows. It has been tested in Windows 7 and 10, but might run under
some earlier versions of Windows. However, it requires .NET Framework and so will not run under
Windows XP. If you get a message saying that you need (a later version of) Microsoft's .NET
Framework, you can download this here. Usually your computer will already have this installed, but
perhaps not the latest version.
Note: the program could fail unless the scaling (control panel/display/make text larger or smaller) is
set at 100% (the default). If you have used the display settings to increase the size of text and other
items on your screen the capture might not work, depending on your configuration and version of
Windows. Under Windows 10, you can right-click on the desktop and follow this path: Display
settings/Advanced display settings/Advanced sizing of text and other
items/Scale to this percentage: this should be “100%”. It looks like:
N.B.: there are a few other programs that might be more useful to you (I have not tried them myself):
2
https://play.google.com/store/apps/details?id=com.kgroth.chessocr&hl=en
https://play.google.com/store/apps/details?id=com.fimetech.chessfimee
http://alain.blaisot.free.fr/DiagTransfer/English/home.htm
http://www.chessgrabber.nicolaas.net/
http://androidfeens.com/chessocr-ocr-chess-diagrams
https://www.youtube.com/watch?v=pckGbzKb7WQ
You need to pick a folder in which to store the data generated by the program. This window is also
reached from the “parms” tab and is shown below. Other fields are explained later.
3
After you pick the data folder, the next window you see is:
Normally there will be no “fonts” in the list. A font represents a style of chess pieces (along with the
board). You will normally establish a separate font for each source that provides images. Typically
this will be a website, but could be any program that generates chess diagrams. To set up a new font,
give it a name and click on the “new” button. The font name should contain only letters, numbers, and
‘_’. It must not contain blanks either. So, the “font” determines the piece/board combination.
We assume the image to capture is already on your computer monitor, so just click on the “capture
4
chessboard” button. The current window will disappear and a “reticle” will pop up. It looks like:
There is a “hole” in the middle through which you can see the desktop (in this case “it’s full of stars!”).
You position the reticle over the image of the chessboard you are capturing, expanding or shrinking it
until the hole just covers the squares on the board. That looks like:
It is important that the outer edges of the squares on the border be covered by the reticle’s “hole”. The
upper left hand corner of the hole in the reticle should be close to that of the chessboard’s. This is not
5
too critical; however, a little of the chessboard's border should be captured as well (on each side), as
you see here. Also, if you make this reticle too large CBC will not find the chessboard.
There are two checkboxes: uncheck “black at top” if the board is showing white at the top. Uncheck
“white to move” if it is black's move in the position. Once the two boxes are checked correctly, click
on the “capture” button and the following window will appear:
This is the window you use to identify the pieces (and empty squares) on the board. It contains a
grayscale version of the image you captured. Click the button indicating the color/type of a piece and
then click on all pieces of that type and color. You can use the mouse’s scroll wheel to select the next
piece/color instead of clicking on the button. This might be more convenient than moving the mouse to
the buttons.
I recommend you do the empty squares first.
As you identify the pieces the red squares will turn to white or black (if the piece is white or black
respectively), and the '?' will be replaced by the first letter of the piece type ('N' for knight). Uppercase
letters are used for white pieces, lowercase for black. If the pieces are on their home squares you can
save time by checking the “board is at start game” box. Once all pieces have been identified, the
window will look thus:
6
Often the system will learn pieces as you click saving you some trouble. Note that it is easy to miss a
square that has a piece, but which has been misidentified as an empty square. Be sure to check the
upper left corner to verify that all pieces have been marked.
Some squares are marked with a gold square in the bottom right corner. This indicates that the program
is not confident of the assignment. If the assignment is correct you do not have to click on the square.
If it is wrong, you must correct it.
The “finish” button appears after all the “?”s have been cleared. At this point you can click on “cancel”
or “finish”. If the latter, the FEN string will appear and the program will also copy this to the
Windows clipboard.
You can then paste it into a receiving program, such as a database program. For example, the SCID
database program has a menu item “Edit/Paste Start Board”. Clicking on that will cause the FEN to be
given to SCID and the SCID board will be updated with the captured position. Then you can ask SCID
to save the position in its database. Other programs may wish you to paste the FEN string, so you
would use the keyboard CNTL-V (a Windows standard function) for this.
Option: the “parms” page has an option to automatically set up for a new capture when you click the
finish button. See below.
Under normal conditions CBC will (in time) learn the style (font) of the pieces and automatically set
the appropriate color/style so that you do not have to click on each piece. Once CBC has seen enough
of each piece, for each color, the gold marks will disappear and the program is close to identifying all
pieces correctly. However, you will still need to verify the assignments and click on “finish” only
when all are correct. CBC is not perfect and will occasionally misidentify a piece.
Unusual Situations
7
Rarely, CBC will not be able to locate the chessboard within the image. This can happen if you make
the reticle extend to far beyond the chessboard (just recapture with a smaller reticle). Other cases occur
if the squares are indistinct or if the contrast between dark and light squares is small, or if the board
squares are textured in an ornate fashion. However, the capture should work on most diagrams,
including ones whose dark squares are “hatched”, like the following:
If the capture is unsuccessful you will see a message. Dismiss this and you should still be able to
identify the pieces and capture the FEN. The captured image will look something like:
8
The mouse should be inside a gold square when you click to identify the piece. If the gold squares are
too far off from the actual ones (as in the above example), recapture the chessboard fitting the capture
reticle more closely to the image. CBC cannot tell which squares are occupied nor when you are
finished.
Be sure to check “cancel learning” before you click on “finish”.
You must click on the “finish” button when you are done. The program cannot “learn” the piece style
and hence all usage of this font will be “manual”. You should be able to capture any diagram using
this procedure.
Sometimes a chessboard will contain extraneous information, such as arrows, crosses, circles and other
notation. Here is an example of such a capture:
You can see that CBC thinks the squares covered by the arrows are occupied by pieces (hence the red
squares in their upper left corners). You should click the “empty” button and then click on all the
squares that the program has incorrectly marked as occupied. Similarly, for the squares that have the
tail or head of the arrow, as well as a piece, you must identify the piece to the program in the usual
way.
Because you do not want the program to learn a piece whose square includes the arrow, check “cancel
learning” before you click on “finish”. This insures that CBC does not learn any of the pieces.
9
In this chessboard, not all empty white squares are the same, nor are all empty dark squares the same.
The “textures” differ. This slows down the learning considerably for each piece, since both the piece
pixels and background pixels are used to characterize a piece/square-color combination. (This diagram
was taken from from this site.
10
Additional Features
The “parms” window lets you specify parameters. It looks like:
The data folder “pick” button lets you choose the directory for the data created by the program. This
includes font data and a file for the pgn (that file name is specified in the “file name” box).
In addition to the FEN string, CBC outputs positions in “pgn” (portable game notation) format. Some
programs prefer to accept data in this format rather than FEN.
You can set any pgn fields in the appropriate box. These values can be suited to your purpose. E.G.
you could use the “white” field to store the category of the position/puzzle (e.g. pin, fork, back rank
mate, etc). CBC uses the “siteSeq#” parameter to construct a unique id for the position. It prepends
“site” to this number (e.g. “site0001”). This can be used to search a database on this field and thus find
the single position you captured with that “site”. One use for this is as part of a “flash card” deck for
reviewing puzzles you are trying to learn.
During one run of the program (i.e. between the times it is started and then closed down), all the
positions will be stored in a single file (this file is emptied upon program startup). Thus you can
capture a number of positions and then submit them all at once to a database program. E.G. the
database program SCID has a menu item: “tools/import a file of pgn games” which you would use to
load all positions you have captured.
Note: Yatt is a good place to store chess puzzles.
The option “new capture on finish” lets you set up for a new capture by clicking the “finish” button (on
the previous puzzle). Then, the main window will disappear and the reticle is shown. This option
assumes you are collecting puzzles all with the same font. Normally, the previous puzzle’s webpage
11
would let you click “return” on the browser which shows you links to other puzzles. You click on a
link for a new puzzle (in the same font). (You can click “through” the reticle window if necessary to
put the mouse on the puzzle link). The reticle will be positioned in the same spot as before, ready for
you to click “capture” on the new puzzle.
CBC contains two other tabs: “board limits” and “stats”. These are helpful in understanding how the
program recognized the chessboard and the individual pieces. The former has gold lines indicating the
boundary of the board and the interior of each square. These lines should correctly delineate the
squares. If they do not, try recapturing the diagram with a better fit of the reticle over the diagram.
Note that the corners of the squares are marked too: these are excluded when capturing piece data
(some diagrams use the corners to show square coordinates).
The “stats” tab contains information that is useful for understanding the learning algorithm. Here is an
example:
The first section is the status before the capture, the second after you have clicked the finish button. The
missing pieces/FINISH section in this example says that we need to see, on light squares, white pieces
for bishop, queen, and king and for black pieces, a knight, bishop, queen, and king. On dark squares,
we need to see a white knight and queen, and a black queen. Then we will have seen all piece/square-
color combinations and the learning will become more accurate for all piece/square combinations.
Q: After I click on the “capture chess board” button, I change my mind and want to cancel, but the
main window has disappeared. How do I cancel?
12
A: Just move the reticle anywhere and click on its “capture” button. Then the main window will
appear and you can cancel from there.
Q: When I click on a pawn the program recognizes some of the other pawns. Then when I click on an
unrecognized pawn it “forgets” some of the ones it recognized and I have to click on them too; why?
A: CBC is still learning the pieces. As you click on them, the criteria becomes more and more
stringent so that some pieces no longer pass the test (and become unrecognized). Eventually the
program will learn all the pieces and subsequent positions (from the same source, using the same font)
will be recognized more quickly.
Q: Sometimes I see a gold square in the lower right corner of a square. What does this mean?
A: CBC is still learning that piece. It “guessed” at the piece because it was close to one it had seen
previously. If the “guess” is correct, there is no need to reinforce it by clicking on the square with the
correct piece. Not all incorrectly assigned pieces will be so marked, so you must still look at each
square to be sure identification is correct.
Q: CBC made a lot of mistakes: I don’t see any gold marks in the image, but many of the pieces are
miss-identified. What is wrong?
A: Even in the best of circumstances, take the gold mark (or its absence) with a grain of salt. CBC can
be in error, even if it thinks no gold mark is warranted. Be careful to check the assignments every time
before you click the finish button.
This could also mean that you have used the incorrect font as the source of the diagram or miss-tagged
the piece yourself (either on the current capture or a prior one). If CBC seems hopelessly confused,
delete the font and start over.
Q: If I make a mistake (and have clicked on “finish”) will CBC eventually correct itself?
A: It will, but it might require many different captures of new positions. If you are impatient, just
delete the font and start over.
Q: Why does the program indicate a piece where there is no piece and how do I fix it?
A: This happens when the square’s background is so murky and has such variance that CBC thinks it
must be occupied. Use the “empty” button to mark the square as empty. The program must learn
empty squares the same way it learns pieces.
Q: Why doesn’t CBC indicate a piece where there really is a piece and how do I fix it?
A; This is the opposite problem to the one above. The contrast between the piece and the background
of the square is too small for CBC to detect the piece. Just click the appropriate color/piece button and
then click on the square.
Example
1. Go to a website with a chess diagram. For example, http://www.chessvideos.tv/chess-puzzle-of-the-
day.php
2. Use CBC to capture it and thus put the FEN on the clipboard.
3. Go here and paste the FEN
4. Use that website and its engine to solve the problem.
I use CBC to capture a puzzle from a website and then I paste the FEN into SCID (a free chess
database program). That lets me save the puzzle and/or use an engine to solve it. If the puzzle is a good
one, I store it in Yatt.
Acknowledgment
This program was inspired by the diagram transfer tool found at
http://alain.blaisot.free.fr/DiagTransfer/English/home.htm. You might wish to look at this program as
an alternative for capturing chess diagrams.
Please contact the author, Fred Mellender, at [email protected], to report bugs or suggestions. If
you can include a screenshot of the board (or better, the website) you are trying to capture that would
help. I would appreciate knowing who is using this software. I am still twiddling with the software, so
look for new versions once and awhile.
This software is free, but no guarantee as to its suitability or correctness is given. You can make copies
of the program and distribute it freely, but please include this document.
This software and documentation is copyright 2021 by Fred Mellender and is not to be sold.