Converting chess positions from a book to FEN

Sort:
metterklume

Hi guys,

I wrote a program to convert chess positions from books directly to FEN. It only works with fonts that are usually used in books and magazines (click the random example for uh examples). But it's pretty good with blurring, noise etc. Check it out! 

 

null

EscherehcsE

It works pretty well. Is there a chance you could make it downloadable so we don't have to depend on the internet?

metterklume

Thanks.

I'm going to upload the source code and put a link on that page. But unfortunately you'd only be able to run it from the command line.

hairhorn

This is really nice!

The black squares seem to be harder for it, but this is still pretty amazing stuff. 

I saw one example with 16 black pieces where black had two dark square bishops, which isn't possible. I wonder if adding a few simple rules in would help the performance. 

EscherehcsE

I've been using Fred Mellender's "Chessboard Capture Program". It's pretty easy to use, but it can't handle dark squares with the older style cross-hatching, as shown in your Post #1 diagram. It's a shame that I can't merge the best features of both programs.

MickinMD

Thank you, metterklume - you've created a useful website!

metterklume
hairhorn wrote:

This is really nice!

The black squares seem to be harder for it, but this is still pretty amazing stuff. 

I saw one example with 16 black pieces where black had two dark square bishops, which isn't possible. I wonder if adding a few simple rules in would help the performance. 

 

Can you send me a couple of examples where that happens? My code does do a second pass to make sure there are only two kings, at most two queens etc. but not the bishops yet. Email is gophergoon at gmail

The dark squares are really the hard part. In certain typefaces the cross-hatching is so dense that any recognition algorithm will find pieces where there are none. Also white and black queens are sometimes hard to tell apart even for humans happy.png

hairhorn

Yeah, these things are hard to read at the best of times, so I'm impressed that it works at all. 

The two bishops example I saw was just one of your random examples, so I can't give you a link to it. 

I also found another of the random ones with 17 black pieces, here's the FEN if that helps you find it: 

 

2n1r1k1/ppq3pp/2b1prn1/P2p2p1/2p2P2/B1P2Nb1/2PQ2Bb/RR4K1

 

 

hairhorn

Here, I clicked though a few more times to find the two dark bishops example: 

 

null

LethalRook_1892
Oh look

Fen is here
hairhorn

Black managed to get 18 pieces here:

null

 

... still super cool, though

Daybreak57

It said it could not find the chess board on this image...

 

null 

metterklume

@hairhorn: tuned it a bit so now it's better on those examples (but not perfect sad.png)

@daybreak57: Yeah when there's warping in the image eg. when the border is pretty curved, it won't work at all. Right now, this is too hard for me to solve (actually I doubt there is a good solution). You can look up the android app 'chessify'.

metterklume

...and just in case someone here is a web developer and is familiar with Flask (python) and jquery, I have a basic question. In fact it's here: https://redd.it/7dmrq1