how to extract the orange color from the image? how to convert the red band to orange band?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
i want to change the red band of the image to the orange band others remaining unaffected.
Respuestas (1)
Image Analyst
el 13 de Abr. de 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 comentarios
Ver también
Categorías
Más información sobre Modify Image Colors en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!