how to draw a checkerboard with 9 squares each with 0.5 dimension?
Show older comments
I tried it by using the checkerboard command but it only gives us a even number of squares.
3 Comments
mbonus
on 20 Sep 2016
I would assume that MATLAB won't allow you to create a checkerboard with an odd number of squares due to the fact that by definition checkerboards have an even amount of squares on a side. The easiest way would most likely by to create a logical matrix representing the squares and calling image().
Geoff Hayes
on 20 Sep 2016
dinesh - please clarify 0.5 dimension means. I'm guessing it has something to do with the dimension of each square in the checkerboard but you will need to provide more information. Also, is this homework?
dinesh varma penmetsa
on 20 Sep 2016
Answers (2)
Thorsten
on 20 Sep 2016
0 votes
You cannot create an image with pixels of dimension 0.5. The dimension of a pixel is always 1. Or what do you mean by 'with dimension 0.5'?
1 Comment
dinesh varma penmetsa
on 20 Sep 2016
Edited: dinesh varma penmetsa
on 20 Sep 2016
Image Analyst
on 20 Sep 2016
0 votes
You can't have half a matrix element, but you can define the "width" of the element to be 0.5 or whatever you want. Then just use repmat(). First create one dark/light pair on one line. Then use repmat() to make a complete line. Then use repmat again to make a "band". Stitch together a band with a band of the opposite colors to get a band pair, like the top two rows of a chessboard. Then use repmat again to make as many vertical pairs as you want.
Categories
Find more on Image Arithmetic in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!