how to create black and white checkerboards with different number of squares
1 view (last 30 days)
Show older comments
Jimmy Liang
on 18 Apr 2019
Commented: Walter Roberson
on 25 Apr 2019
How can I create black and white checkerboard with different number of squares, for example, 2 squares, 4, 8, 16,32....
with the inbuilt checkerboard function, there is grey squares, which is undesirable
0 Comments
Accepted Answer
Adam Danz
on 18 Apr 2019
Edited: Adam Danz
on 23 Apr 2019
The output of checkerboard() contains normalized values where 0 represents black, 1 represents white, and values between represent shades of gray. Just replace the values greater than 0 with 1.
I = checkerboard(20);
I(I>0) = 1;
imshow(I)
3 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!