Tuesday, 9 October 2012

Game Player - Step 1.5 - Tidying Up The Code

We have done a lot of work over the last few posts and looked at some interesting features of OpenCV.

As it stands there is a lot of this stuff, although handy for debugging, we don't need in our final system. Things like the calls to printf and cout slow the system down unnecessarily so we can remove them. We can also take this opportunity to separate the majority of the code into its own method that completes the task of getting the game state. This will make the flow of the call to C easier to see and allow us to easily replace ways of completing a task (such as finding the colour of a game piece in an image) easier which is handy if we want to try out new algorithms.

Tuesday, 2 October 2012

Game Player - Step 1 - Representing the Game Board

I'd say we are just about finished Step 1 now which looking back at the first post for this project I said should "Grab an image of the game board." Well we've definitely done that and we've also separated the game board out from the rest of the image to make the rest of the processing easier and faster but there is still a few things to take care of before I can officially declare us on Step 2.

Although we can see the game board the computer still can't really see it. It's kind of like in the last post when we had worked out the purple areas but still had to do a little processing for the computer to be able to make sense of it. What we need to do is represent the game board in a way the computer can understand it and that is what this post, and the end of Step 1, is going to be all about.
Our captured game board