Differentiation of RGB colors in objects.
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Damian
le 26 Jan 2018
Réponse apportée : Image Analyst
le 27 Jan 2018
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 commentaires
Image Analyst
le 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.
Réponse acceptée
Image Analyst
le 27 Jan 2018
You can get the individual color channels like this:
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
Then you segment it to get your triangle mask then get mean intensity of each color channel individually:
propsR = regionprops(mask, redChannel, 'MeanIntensity', 'Area'); % Or whatever you want to measure.
propsG = regionprops(mask, greenChannel, 'MeanIntensity', 'Area'); % Or whatever you want to measure.
propsB = regionprops(mask, blueChannel, 'MeanIntensity', 'Area'); % Or whatever you want to measure.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Environment and Settings dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
