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
|
|
|
% Insert your code here
OpenCV
|
|
|
// 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
|
|
|
% Insert your code here
OpenCV
|
|
|
// 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).
|
|
|
|
|
|
|
|
|
|
|
|
// Insert your Matlab code here
// 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.
|
|
|
|
|
|
|
|
|
|
|
|
// Insert your Matlab code here
// 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.
|
|
|
|
|
|
|
|
|
|
|
|
// Insert your Matlab code here
// 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.
|
|
|
|
|
|
|
|
// 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.
|
|
|
|
|
|
|
|
// 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.
|
|
|
|
|
|
|
|
// Insert your code here
Part 4B
Modify your program from Part 4A to work with a slightly noisy board with grain.
|
|
|
|
|
|
|
|
// Insert your code here
Part 5A
Detect the position and color of all chess pieces and output the information to a text file.
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)
|
|
|
|
|
|
|
|
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. |
// Insert your code here
Part 5B
Modify your program from Part 4B to work with a slightly noisy board with grain.
|
|
|
|
|
|
|
|
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. |
// 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)
|
|
|
|
|
|
|
|
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. |
// Insert your code here
Part 6A (EXTRA CREDIT)
Swap all queens for pawns and pawns for queens. (FOR EXTRA CREDIT)
|
|
|
|
|
|
|
|
// Insert your code here
Part 6B (EXTRA CREDIT)
Modify your code to work with grain added to the images. (FOR EXTRA CREDIT)
|
|
|
|
|
|
|
|
// Insert your code here
Part 6C (EXTRA CREDIT)
Repeat 6A again, but with real images of the screen. (FOR EXTRA CREDIT)
|
|
|
|
|
|
|
|
// Insert your code here