フィルターのクリア

My question is regarding classifying the images based on the whichever color is present more in the given image after converting the color image into gray and finding its histogram.

1 回表示 (過去 30 日間)
clc;
Image = imread('rose.jpg');
figure
imshow(Image);
I=rgb2gray(Image);
figure
imshow(I)
[count,x] = imhist(I)
index1 = find(x == 67);
index2 = find(x == 100);
numPixels = sum(count(index1:index2))
This code worked well up to finding the sum of number of pixels from one intensity range to other.
Now I am having few images. Some of them have red pixels in large amounts,some have white, some have blue, etc. I have to classify these images as blue, white, red, etc. after finding histogram and counting pixels in certain range. How can I do that?
Or is there any other way to do this classification?

採用された回答

Image Analyst
Image Analyst 2016 年 12 月 3 日
You just need to set up some rules, like if the mean red count from the histogram is more than the mean blue and green counts. See my File Exchange for color demos. http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
  9 件のコメント
Image Analyst
Image Analyst 2016 年 12 月 7 日
Did you see where I said " it was released way back in 2012 but maybe you have an ancient version of MATLAB." Well, 2010 is 2 years before atan2d was released. You'll have to see how you can build it yourself with atan() or atand(). Search the Mathworks web site for the description of atan2d().
snehal jaipurkar
snehal jaipurkar 2016 年 12 月 7 日
編集済み: snehal jaipurkar 2016 年 12 月 7 日
Ok sir...I vl try to do that if I can get proper results by using atand( )... Thanks a lot for u help sir...

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by