MATLAB Answers

checkerboard problems, please help me

4 views (last 30 days)
abory kikla
abory kikla on 10 Mar 2016
Commented: Walter Roberson on 10 Mar 2016
checkerboard=checkerboard(64,8,8);
checkerboard=(checkerboard>0.5);
checkerboard=bwlabel(checkerboard,8);
Here the use of the rand function error occurs with me,,

Answers (1)

Walter Roberson
Walter Roberson on 10 Mar 2016
When you call checkerboard that first time, you assign to a variable named "checkerboard". As soon as you do that, "checkerboard" stops referring to the function in that workspace and starts referring to the variable. You would not be able to call the function again in that workspace unless you cleared the variable.
  3 Comments
Walter Roberson
Walter Roberson on 10 Mar 2016
One thing to keep in mind is that your checkboard is going to look something like
0 0 1 1
0 0 1 1
1 1 0 0
1 1 0 0
Notice that the upper right and lower left are connected by the diagonal. You are requesting 8 connection for bwlabel so that includes the diagonals. Everything is going to be detected as belonging to the same image. You should be requesting 4 connection instead of 8.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!