how to extract the orange color from the image? how to convert the red band to orange band?
1 回表示 (過去 30 日間)
古いコメントを表示
i want to change the red band of the image to the orange band others remaining unaffected.
回答 (1 件)
Image Analyst
2015 年 4 月 13 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Convert Image Type についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!