I want to divide a hue image into 10 sectors.for that first i multiplied obtained hue image by 360.how can i do this?? is there any function to divide hue image into sectors.
No products are associated with this question.
How about logical indexing? Multiplying by 360 is not necessary. Why do you think it is?
h1 = h(h < 0.1); h2 = h(h > 0.1 & h < 0.2); h3 = h(h > 0.2 & h < 0.3);
etc. up to h10. If you want an image instead of a list of values, then you'll have to do masking
h2 = h .* double(h > 0.1 & h < 0.2);
Ncolors = 10;
I = imread('peppers.png'); HSV = rgb2hsv(I); H = HSV(:,: ,1);
Hnew = zeros(size(H)); delta = 1/Ncolors; for range = delta:delta:1 B = H >= range - delta & H < range; Hnew(B>0) = range - delta/2; end
HSV(:,:,1) = Hnew; subplot(1,2,1), imshow(I) subplot(1,2,2), imshow(hsv2rgb(HSVnew))
Play games and win prizes!Learn more