can u please tell me how to write the number of unique hues included in an in matlab?

3 次查看(过去 30 天)
i have written a code
image = imread('filename');
figure, imshow(image);
hsv_image = rgb2hsv(image);
i = hsv_image(:,:,2)>0.2.* (hsv_image(:,:,3)>0.15 .* hsv_image(:,:,3)<0.95);
figure
hist(i,20);
and further i would like to know how to do this in matlab.
Suppose Q is the maximum value of the histogram. Let the
hue count be the number of bins with values greater than c ⋅Q ,
q = maximum value in histogram
N = {i | H(i) > cq}
here C= 0.1.
plz help me......

采纳的回答

Image Analyst
Image Analyst 2013-10-3
I don't know what you're doing by calculating i. What's the point of that? To get the number of unique hues, you can use the unique() function.
hsv = rgb2hsv(rgbImage);
hueImage = hsv(:,:,1);
numberOfUniqueHues = unique(hueImage)
  7 个评论
mohammed
mohammed 2013-10-4
thanks for replay.. actually i want to write a program for.
f = # of{ i | h( i) > c ⋅Q }
The number of pixels that belong to the most frequent hue is calculated as:
f = max{h (i)}
The hue contrast can be calculated as :
f = max(|| I(i) – I(j)||) ,
i, j ∈ {k | h (k) > c ⋅Q }
where I(i) is the center hue of the ith bin in the hue histogram. The distance metric • refers to the arc-length distance on the hue wheel.
but i am unable to understand how to formulate in matlab....... plz help me......

请先登录,再进行评论。

更多回答(1 个)

Walter Roberson
Walter Roberson 2013-10-3
h = hist(hsv_image(i), 20);
q = max(h);

类别

Help CenterFile Exchange 中查找有关 Histograms 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by