how to extract the orange color from the image? how to convert the red band to orange band?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
i want to change the red band of the image to the orange band others remaining unaffected.
Risposte (1)
Image Analyst
il 13 Apr 2015
Three different color segmentation methods are given in my File Exchange. http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862 You might try the HSV one first.
The basic concept is to find the range of hues that represents orange. Let's say orange ranges from 0.2 to 0.3 in the hue component. Then just set all of those to 0.2 (the shade of red closest to the orange boundary).
hsv = rgb2hsv(rgbImage);
h = hsv(:,:,1);
imshow(h, []); % Display the hue channel
axis on;
s = hsv(:,:,2);
v = hsv(:,:,3);
% Get mask for orange pixels.
orangePixels = h > 0.2 & h < 0.3;
% Set those pixels to a hue of red - the red that is closest to orange
h(orangePixels) = 0.2;
% Now convert back to RGB
hsv = cat(3, h, s, v);
rgbImage = hsv2rgb(hsv);
0 Commenti
Vedere anche
Categorie
Scopri di più su Convert Image Type in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!