Differentiation of RGB colors in objects.

4 ビュー (過去 30 日間)
Damian
Damian 2018 年 1 月 26 日
回答済み: Image Analyst 2018 年 1 月 27 日
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 件のコメント
Image Analyst
Image Analyst 2018 年 1 月 27 日
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 2018 年 1 月 27 日
編集済み: Damian 2018 年 1 月 27 日
"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

サインインしてコメントする。

採用された回答

Image Analyst
Image Analyst 2018 年 1 月 27 日
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 件)

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by