Live data from Hacker News

Show HN: My weekend project - Chessboard picture recognition

codebazaar.blogspot.com

41–50 of 57 posts

Re: Show HN: My weekend project - Chessboard picture recognition

#41
post #3

"For example, the program is able to determine whether each square is white or black by calculating its average color and comparing it to the black and white colors" I bet you could get away with determining the color of a corner square and assuming the rest.

Thanks for the feedback. I did not think about this. Some of the square edges actually belongs to the surroundings squares because the cut is not 100% accurate and the chess piece are not always position at the center of the square but I could get around that. The way this algorithm works is simple. I compare the RGB values for each pixel of a square to the black color and white color. Black is Red=0, Green=0, Blue=0…

Remember that not all chessboards are black and white. some are green and white, for instance.

Re: Show HN: My weekend project - Chessboard picture recognition

#42
post #5

For figuring out chess pieces, maybe determining the light source and looking for light/dark patterns in certain areas? The problem is, from top view, even a human would have a difficult time figuring out if a piece was a bishop or pawn.

This is true. I may need to work on a collection of pictures or even a video.

Get hold of one of those automated chess boards that move pieces around by magnets under the board. Set it to replay old games, and film or photograph it. That should give you unlimited photographs of known positions.

Re: Show HN: My weekend project - Chessboard picture recognition

#43
post #9

Hmm, interesting project. If you're ok with helping the computer out a bit, you could put a very small matrix bar code (think QR Code) on top of each piece. Since there are 6 chess pieces and 2 colors, you could have a code for each piece in just a 2x2 matrix (4 dots / bits). Otherwise, it seems like it may be very difficult, as I'm not even sure of what some of the black on black pieces are myself (bottom right).

If it's actually the problem of locating chessmen you're addressing and you're getting on to special modifications then you'd just use a board with sensors and code carrying pieces.

If you want only to modify the chessmen and not the board then I'm sure some transponder could be fitted and the table could have 3 receivers removably fixed to it that could triangulate their positions.

If it has to be camera based but you're going to modify them men could you just give them all different coloured hats.

Re: Show HN: My weekend project - Chessboard picture recognition

#45
post #38

You might look into the academic literature for OCR, which this will reduce to. (Most AI problems are "How can I apply human intelligence to cleverly reduce this problem from something which appears to require intelligence to something which actually only requires well-understood math?") I think the punchline is likely to be that you end up taking dot products of feature vectors generated by library code and writing…

Thanks patio13! OCR and AI actually seem very sexy to me:D If I make a mobile app out of this, I will get my users to take pictures for me! hehe!

Re: Show HN: My weekend project - Chessboard picture recognition

#46
post #44

similar successful project of a robot playing chess naturally: http://www.youtube.com/watch?v=OZ0Hx04KFCg

I just found out about this. Another YC user left a comment with a link to a paper about Gambit the robot: http://www.cs.washington.edu/ai/Mobile_Robotics/postscripts/...

Re: Show HN: My weekend project - Chessboard picture recognition

#47
post #39

Here is a related project on turning an image of a Go board into a computer readable file understood by most GUIs for playing Go: http://www.inference.phy.cam.ac.uk/cjb/image2sgf.html

Thanks. Go seems to be easier. I was also thinking to fallback to domino if I can completed the project for a chessboard.

Re: Show HN: My weekend project - Chessboard picture recognition

#48
post #32
post #2

I don't know anything about "chess theory" but are there some squares that only certain pieces can get to? I don't think it's possible for a Knight to ever be on some squares, so maybe you could use logic like that to narrow down the piece detection. It may be easier to just track the game state from the start instead of trying to identify the position of the board at a random snapshot in time. Cool project though, s…

The only thing I can think of is that pawns cannot be in the first rank nor the last rank.

What do you mean?? If you can get your pawn to the last row, you can change it to anything. You will probably want to change to a queen, unless you want to irritate your opponent :D

Re: Show HN: My weekend project - Chessboard picture recognition

#49

Earlier quoted context omitted.

Nor will you ever find both bishops of one color on the same color square.

You have to be careful there, you can only make that assertion if you can prove that no pawn has been promoted to a bishop (eg if all 8 pawns are still on the board, or 7 pawns and 2 queens etc).

[deleted]

Re: Show HN: My weekend project - Chessboard picture recognition

#50

Earlier quoted context omitted.

Nor will you ever find both bishops of one color on the same color square.

You have to be careful there, you can only make that assertion if you can prove that no pawn has been promoted to a bishop (eg if all 8 pawns are still on the board, or 7 pawns and 2 queens etc).

Damnit!!! I did not think of that! It is a good one.
Post reply on HN