how do i assign a color to the same type of shape
1 次查看(过去 30 天)
显示 更早的评论
eg. squares=blue eg. circles=r

ed
1 个评论
Adi Pamungkas
2016-7-2
You can see at https://pemrogramanmatlab.wordpress.com/2016/07/02/pengolahan-citra-digital-untuk-mendeteksi-warna-dan-bentuk-obyek/
回答(2 个)
Doug Hull
2014-11-12
If you make this a binary image, you can run it through regionprops. There are a variety of metrics in there that should be usefull in identifying equal shapes. Without much more information, I think this will be enough to get you in the right direction.
Image Analyst
2014-11-12
Once you've identified the shapes, which we've talked about in your other question, you can use a for loop to reassign your labeled region to the desired number, like 1 for squares = blue, 2 for circles = red, and so on. Then just create the colormap and pass that plus the labeled image in to ind2rgb() to get an RGB image with shapes having the desired color.
另请参阅
类别
Find more on Colormaps 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!