Differentiation of RGB colors in objects.
Show older comments
I have to classify (distinguish) 2 triangles in terms of colors. I want to give them the range of colors in RGB. I have similar code to detect this two based only on Area (the fiolet have less pixels than the brown one, even that, that they real sizes are the same. But it dosent work well using (regionprops):
A slice of my code .
min_Area = 6500;
max_Area = 8900;
if (proper(k_iter).Area > min_Area && proper(k_iter).Area < max_Area && found_trojkat_fiolet == 0)
min_Area = 5700;
max_Area = 8000;
if (proper_green(k_iter).Area > min_Area && proper_green(k_iter).Area < max_Area && found_trojkat_brazowy == 0)

Please do not send me to the tutorials i want to do this in a few lines...
3 Comments
Rik
on 26 Jan 2018
Is the goal just to create a mask in situations like this image? Or should the solution be more general.
Color segmentation is often quite difficult. Often it is easier to convert to a gray scale or indexed image and perform the segmentation on that.
Image Analyst
on 27 Jan 2018
I'm not sure what "I want to give them the range of colors in RGB." means. It sounds like you have successfully segmented the two regions and called regionprops() to measure them separately with results being in proper and proper_green. But after that, I don't know what you want to do. They already have RGB colors, so I don't know what you want to give them. Also, your "if" statements don't do anything so there's no clue for me there.
I know you don't want a tutorial but I feel unless you read this one then there's nothing further I can do for you. Good luck though.
Accepted Answer
More Answers (0)
Categories
Find more on Blue in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!