i want to calculate the color features of soap only for that i mask BW ROI on an RGB soap image , i did the folowing code but the values are different when i calculte the color features byi croping only the soap image(with out the background)?Hlp
古いコメントを表示
I want to calculate the color features of soap only for that i mask BW ROI on an RGB soap image , i did the following code but the values are different when i calculate the color features by cropping only the soap image (without the background)? Hlp
 

clear all
clear
RGB=imread('soap170.jpg');
I=rgb2gray(RGB);
% Step 2: Create a Binary Image
level=graythresh(I);
BWgth = im2bw(I,level);
maskThreeChannel = repmat(BWgth , [1, 1, 3]);
RGB2=RGB;
RGB2(~maskThreeChannel)=0;
figure,imshow(RGB2); title('masked RGB')
R = double(RGB2(:, :, 1));
G = double(RGB2(:, :, 2));
B = double(RGB2(:, :, 3));
% compute 3 first color moments from each channel
meanR = mean( R(:) );
stdR = std( R(:) );
skewnessR = skewness(R(:));
meanG = mean( G(:) );
stdG = std( G(:) );
skewnessG = skewness(G(:));
meanB = mean( B(:) );
stdB = std( B(:) );
skewnessB = skewness(B(:));
% construct output vector
colorMoments = zeros(1, 9);
colorMoments(1, :) = [meanR stdR skewnessR meanG stdG skewnessG meanB stdB skewnessB]
3 件のコメント
Image Analyst
2014 年 8 月 9 日
編集済み: Image Analyst
2014 年 8 月 9 日
Read http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup and fix formatting so we can read it.
And what's different? Of course the mean, standard deviation, and skewness will be different for the three different color channels. Are you not expecting that?
solomon adenew
2014 年 8 月 10 日
solomon adenew
2014 年 8 月 13 日
編集済み: solomon adenew
2014 年 8 月 13 日
採用された回答
その他の回答 (1 件)
solomon adenew
2014 年 8 月 15 日
編集済み: solomon adenew
2014 年 8 月 15 日
0 投票
カテゴリ
ヘルプ センター および File Exchange で GigE Vision Hardware についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!