Live data from Hacker News

Show HN: My weekend project - Chessboard picture recognition

codebazaar.blogspot.com

1–10 of 57 posts

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

#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, seems like a good intro to image processing.

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

#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.

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

#4
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…

A knight can in fact visit every position, without even revisiting any of them. Computing this is actually a classic CS problem. Here's proof http://en.m.wikipedia.org/wiki/File:Knight%27s_tour_anim_2.g... :)

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

#6
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…

Knights can make it everywhere. The only position you'd never see is pawns on the first or last rank (their movement is forward and they promote to stronger pieces when reaching the other side).

EDIT: Another feature ... in a properly set up board, the bottom right square is always white.

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

#7
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.

He does say a little further on that he saw one or two errors when pieces of the opposing colour were on those squares. That's not so hard to correct if you've tried to detect every square but would be catastrophic if you only looked at one.

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

#8
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.

Have you seen this? http://www.illusion-optical.com/Optical-Illusions/Chessboard...

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

#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).

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

#10
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.

He does say a little further on that he saw one or two errors when pieces of the opposing colour were on those squares. That's not so hard to correct if you've tried to detect every square but would be catastrophic if you only looked at one.

true. so, test the color of one or two squares detected as empty at random and extrapolate the rest. my point was simply that the pattern rarely changes, and a corner will be white-black or black-white and from that you can determine which way the board is facing, and what every other square's color should be.
Post reply on HN