Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MATLAB Coding please. This is a project for a MATLAB class. I need help on the project on image thresholding, especially the two function files

MATLAB Coding please.
This is a project for a MATLAB class. I need help on the project on image thresholding, especially the two function files listed in the project images. There are multiple test cases, but I will provide Alpha.png for the code to test. Make sure the output is not all zeros, but show the expected results of the test case of Alpha in the document.
These are the starting formats of the two functions:
FindPieces
function [layout]= FindPieces(filename)
layout = zeros(6,7);
end
ScoreLayout
function [score]= ScoreLayout(layout, pnum)
score =0;
end
The testing script is here
name = input('Enter a Connect Four image: ','s');
mat = FindPieces(name);
disp(mat);
s1= ScoreLayout(mat,1);
s2= ScoreLayout(mat,2);
fprintf('Player 1''s score: %g', s1);
fprintf('Player 2''s score: %g', s2);
The expected test case result is:
Enter a Connect Four image: Alpha.png
0000000
0000000
0001000
0211120
0221220
2112112
Player 1s Score: 0
Player 2s Score: 0
Please assist the code in the two function files for the test script to run correctly.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions