Supplementary files for this homework are posted on the class web page.

Part 1A

Write two programs, one with Matlab and another with OpenCV, that identify each of the 64 squares on the chess board and labels them with 'a1', 'b1', 'a2', ..., 'g8' and 'h8'. In each label, the letter indicates the column and the digit indicates the row, starting from the bottom left corner. Your programs should place one label in each of the 64 squares. See this Wikipedia page for more information about this labeling system.

Matlab

input/Part_1/p1_board.jpg

Handle

Source
                           % Insert your code here
											

OpenCV

input/Part_1/p1_board.jpg

Handle

Source
// Insert your code here
											

Part 1B

Write two programs, one with Matlab and another with OpenCV. Each of the two programs should flip the color of all squares, i.e., black to white, and white to black.

Matlab

input/Part_1/p1_board.jpg

Handle

Source
% Insert your code here
											

OpenCV

input/Part_1/p1_board.jpg

Handle

Source
// Insert your code here
											

Part 2A

Write two programs, one with Matlab and another with OpenCV. Each program should find all pawns in the chessboard images below and highlight them (e.g., by drawing a bounding box around the pawn with a bright color).

input/Part_2/p2_board_1.jpg

input/Part_2/p2_board_2.jpg

input/Part_2/p2_board_3.jpg

output/Part_2a/placeholder.jpg

output/Part_2a/placeholder.jpg

output/Part_2a/placeholder.jpg

output/Part_2a/placeholder.jpg

output/Part_2a/placeholder.jpg

output/Part_2a/placeholder.jpg

Source (Matlab)
// Insert your Matlab code here
										
Source (OpenCV)
// Insert your OpenCV code here
										

Part 2B

Count the number of black pawns and white pawns and place each pawn's index, starting from one, as a text overlay over each pawn accordingly. Thus, for example, the pawn in 'a2' gets the index 1;, the pawn in 'b2' gets the index 2, and so forth until the last pawn gets the index 16.

This part requires two programs, one in Matlab and another with OpenCV. Your program can count black and white pawns separately or it can count all pawns regardless of their color.

input/Part_2/p2_board_1.jpg

input/Part_2/p2_board_2.jpg

input/Part_2/p2_board_3.jpg

output/Part_2b/placeholder.jpg

output/Part_2b/placeholder.jpg

output/Part_2b/placeholder.jpg

output/Part_2b/placeholder.jpg

output/Part_2b/placeholder.jpg

output/Part_2b/placeholder.jpg

Source (Matlab)
// Insert your Matlab code here
										
Source (OpenCV)
// Insert your OpenCV code here
										

Part 2C

Flip the colors of all pawns so that white becomes black and black becomes white. This part requires two programs, one in Matlab and another with OpenCV. Your program can count black and white pawns separately or it can count all pawns regardless of their color.

input/Part_2/p2_board_1.jpg

input/Part_2/p2_board_2.jpg

input/Part_2/p2_board_3.jpg

output/Part_2c/placeholder.jpg

output/Part_2c/placeholder.jpg

output/Part_2c/placeholder.jpg

output/Part_2c/placeholder.jpg

output/Part_2c/placeholder.jpg

output/Part_2c/placeholder.jpg

Source (Matlab)
// Insert your Matlab code here
										
Source (OpenCV)
// Insert your OpenCV code here
										

Part 3A

Write a program to find all rooks and highlight them (fill in the rook with another color). Solve this and all subsequent problems using either MATLAB or OpenCV. That is, only one program is necessary starting from Part 3A.

input/Part_3/p3_board_1.jpg

input/Part_3/p3_board_2.jpg

input/Part_3/p3_board_3.jpg

output/Part_3a/placeholder.jpg

output/Part_3a/placeholder.jpg

output/Part_3a/placeholder.jpg

Source
// Insert your code here
										

Part 3B

Modify your program to find all rooks, bishops, queens, and highlight them with a bright color. Use three different highlighting colors, to differentiate between these three types of chess figures.

input/Part_3/p3_board_1.jpg

input/Part_3/p3_board_2.jpg

input/Part_3/p3_board_3.jpg

output/Part_3b/placeholder.jpg

output/Part_3b/placeholder.jpg

output/Part_3b/placeholder.jpg

Source
// Insert your code here

Part 4A

Detect all white pawns on the top line, and all black pawns on the bottom line, and replace them with queens of the same color. That is, replace all white pawns on line 8 with white queens and all black pawns on line 1 with black queens.

input/Part_4/p4_board_1.jpg

input/Part_4/p4_board_2.jpg

input/Part_4/p4_board_3.jpg

output/Part_4a/placeholder.jpg

output/Part_4a/placeholder.jpg

output/Part_4a/placeholder.jpg

Source
// Insert your code here
										

Part 4B

Modify your program from Part 4A to work with a slightly noisy board with grain.

input/Part_4/p4_board_1_grain.jpg

input/Part_4/p4_board_2_grain.jpg

input/Part_4/p4_board_3_grain.jpg

output/Part_4b/placeholder.jpg

output/Part_4b/placeholder.jpg

output/Part_4b/placeholder.jpg

Source
// Insert your code here
										

Part 5A

Detect the position and color of all chess pieces and output the information to a text file.

Text Output Example for Image 1
A8: Black Rook
B8: Empty
C8: Empty
... (continue top row (8) here)

A7: Black Pawn
B7: Black Pawn
... (continue row here)

...
... (continue middle rows here)

A1: White Rook
B1: Empty
C1: Empty
D1: White King
... (continue bottom row (1) here)

input/Part_5/p5_board_1.jpg

input/Part_5/p5_board_2.jpg

input/Part_5/p5_board_3.jpg

output/Part_5a/placeholder.jpg

output/Part_5a/placeholder.jpg

output/Part_5a/placeholder.jpg

Output 1:

Enter the output of your program here.

Output 2:

Enter the output of your program here.

Output 3:

Enter the output of your program here.
Source
// Insert your code here
										

Part 5B

Modify your program from Part 4B to work with a slightly noisy board with grain.

input/Part_5/p5_board_1b_grain.jpg

input/Part_5/p5_board_2b_grain.jpg

input/Part_5/p5_board_3b_grain.jpg

output/Part_5b/placeholder.jpg

output/Part_5b/placeholder.jpg

output/Part_5b/placeholder.jpg

Output 1:

Enter the output of your program here.

Output 2:

Enter the output of your program here.

Output 3:

Enter the output of your program here.
Source
// Insert your code here
										

Part 5C (EXTRA CREDIT)

Detect the position and color of all chess pieces again, but with real images of the screen. (FOR EXTRA CREDIT)

input/Part_5/p5_board_1_screen.jpg

input/Part_5/p5_board_2_screen.jpg

input/Part_5/p5_board_3_screen.jpg

output/Part_5c/placeholder.jpg

output/Part_5c/placeholder.jpg

output/Part_5c/placeholder.jpg

Output 1:

Enter the output of your program here.

Output 2:

Enter the output of your program here.

Output 3:

Enter the output of your program here.
Source
// Insert your code here
										

Part 6A (EXTRA CREDIT)

Swap all queens for pawns and pawns for queens. (FOR EXTRA CREDIT)

input/Part_6/p6_board_1.jpg

input/Part_6/p6_board_2.jpg

input/Part_6/p6_board_3.jpg

output/Part_6a/placeholder.jpg

output/Part_6a/placeholder.jpg

output/Part_6a/placeholder.jpg

Source
// Insert your code here
										

Part 6B (EXTRA CREDIT)

Modify your code to work with grain added to the images. (FOR EXTRA CREDIT)

input/Part_6/p6_board_1_grain.jpg

input/Part_6/p6_board_2_grain.jpg

input/Part_6/p6_board_3_grain.jpg

output/Part_6b/placeholder.jpg

output/Part_6b/placeholder.jpg

output/Part_6b/placeholder.jpg

Source
// Insert your code here
										

Part 6C (EXTRA CREDIT)

Repeat 6A again, but with real images of the screen. (FOR EXTRA CREDIT)

input/Part_6/p6_board_1_screen.jpg

input/Part_6/p6_board_2_screen.jpg

input/Part_6/p6_board_3_screen.jpg

output/Part_6c/placeholder.jpg

output/Part_6c/placeholder.jpg

output/Part_6c/placeholder.jpg

Source
// Insert your code here