Differentiation of RGB colors in objects.

1 Ansicht (letzte 30 Tage)
Damian
Damian am 26 Jan. 2018
Beantwortet: Image Analyst am 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 Kommentare
Image Analyst
Image Analyst am 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.
Damian
Damian am 27 Jan. 2018
Bearbeitet: Damian am 27 Jan. 2018
"I'm not sure what "I want to give them the range of colors in RGB." means." I mean - intensity of color brightness- Eazy men. Its hard to put it in the word for me. Mayby i can visualize it: In RGB code... like gradient style: :for violet
max is: 211,150,188
min is: 128,93,118
and for brown:
max: RGB: 132,108,101
min: RGB: 48,42,37
It is only my idea. I have changing lighting conditions in my lab and it is very frustrating.Tomorrow i will use special LED for enlighten the scene.
Its about intensity of color brightness (brighter violet, darker violet), (brighter brown, darker brown).
"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."
On this two I did not carry out segmentation of colors. It was only for Area props. I want to put more perimeters to good classifie.
Sory, that I did not express myself too clearly

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Image Analyst
Image Analyst am 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.

Weitere Antworten (0)

Kategorien

Mehr zu Environment and Settings finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by