I want to divide the 360 degree hue circle into 10 equal sector
2 views (last 30 days)
Show older comments
Hiii...
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.
0 Comments
Answers (2)
Image Analyst
on 17 Nov 2012
Edited: Image Analyst
on 17 Nov 2012
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);
etc.
11 Comments
Image Analyst
on 2 Feb 2017
That would be a totally different question. TOTALLY different. You can't even adapt the code above at all.
You'd have to create sectors with the FAQ http://matlab.wikia.com/wiki/FAQ#How_do_I_create_an_arc.3F and then use poly2mask() to get a masked image, if that's what you want.
Thorsten
on 12 Feb 2013
Edited: Thorsten
on 12 Feb 2013
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))
2 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!