checkerboard problems, please help me

checkerboard=checkerboard(64,8,8);
checkerboard=(checkerboard>0.5);
checkerboard=bwlabel(checkerboard,8);
Here the use of the rand function error occurs with me,,

답변 (1개)

Walter Roberson
Walter Roberson 2016년 3월 10일

0 개 추천

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

abory kikla
abory kikla 2016년 3월 10일
편집: Walter Roberson 2016년 3월 10일
Well, I used the rand function but the result is an image in one color and not colored chess:
J = checkerboard(10,5,5);
>> J=(J>0.5);
>> J = bwlabel(J,8);
>> ra=rand(20,3,4);
>> RGB = ind2rgb(J,ra);
>> imshow(RGB);
Walter Roberson
Walter Roberson 2016년 3월 10일
"The colormap, map, is a three-column array of values in the range [0,1]. Each row of map is a three-element RGB triplet that specifies the red, green, and blue components of a single color of the colormap. "
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.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Images에 대해 자세히 알아보기

질문:

2016년 3월 10일

댓글:

2016년 3월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by