Computer Vision Interactive Battleship

Lab Partner: Lydia Tang

In this project, we use a single computer and projector to simultaneously project and record an interactive display for users to play the classic board game of Battleship.  The process is described in the Youtube video above. Essentially, the system first captures a blank reference frame and a series of projected dots as reference points on the board to establish an automatic homography between the camera recorded image and the computer display image. Afterwards, the established homography can be used to map the camera image to a rectified image of the game board.  In live time, the code allows for users to draw crosses and circles to represent target selections on the game board. We first apply a large erosion to determine if there are any obstructions to the game board,

* An example of an obstructed board.

and then apply opening morphology with a small kernel before calculating the correlation to a set of cross and circle templates once the coast is clear.

*An example of an unobstructed image to apply template matching.

Then using hysteresis thresholding, we determine if the object is a cross or a circle. A game class and a player class in the background then handle the game logic behind Battleship, and prohibits any erroneous moves. For the sake of brevity in the demonstration, the computer randomly generates the starting positions of the 5 ships.

*As aspects of  code can be used by future students for lab, the private Github Repository link will be available on request.

Leave a Reply

Your email address will not be published. Required fields are marked *