Generate binary image of geometric shapes?
Show older comments
I need a code where I can generate different geometric shapes in a form of a binary image. Please assist me as I am not very good with Matlab Image Processing.
Accepted Answer
More Answers (1)
Alka Nair
on 6 May 2015
2 votes
Hi, For generating geometric shapes in binary images use STREL to create the structuring element, for example, suppose you want to generate a square. The steps are as follows: >>img = zeros(100,100); >>imgLogical = logical(img); >>img(50,50)=1; % fixing the initial seed point >>se1 = strel('square',12); >>im2 = imdilate(f,se1);
Please refer to the documentation for STREL at the following location: http://www.mathworks.com/help/images/ref/strel.html
1 Comment
Yashlin Naidoo
on 6 May 2015
Categories
Find more on ROI-Based Processing 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!