MATLAB Answers

how do i assign a color to the same type of shape

조회 수: 6(최근 30일)
jason
jason 12 Nov 2014
댓글: Adi Pamungkas 2 Jul 2016
eg. squares=blue eg. circles=r
ed

  댓글 수: 1

Adi Pamungkas
Adi Pamungkas 2 Jul 2016
You can see at https://pemrogramanmatlab.wordpress.com/2016/07/02/pengolahan-citra-digital-untuk-mendeteksi-warna-dan-bentuk-obyek/

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

답변(2개)

Doug Hull
Doug Hull 12 Nov 2014
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.

  댓글 수: 1

jason
jason 13 Nov 2014
thank you, but i am not allowed to use region prop command.

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


Image Analyst
Image Analyst 12 Nov 2014
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.

  댓글 수: 2

jason
jason 13 Nov 2014
Where about would i put that code Image Analyst, note that i have to get a black and white binary output with the shape assigned a number to it which we did yesterday, now i have to group the shapes and assign each group a different color. How should i go about doing it? Please note i have a few hours before i present and do not have matlab on this current pc.
jason
jason 13 Nov 2014
here is my code with the classified shapes, take a look @ it please, where would i add the color to codes.

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

범주

Community Treasure Hunt

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

Start Hunting!

Translated by