Info
此问题已关闭。 请重新打开它进行编辑或回答。
How to classify the color of each pixel using its RGB values
1 次查看(过去 30 天)
显示 更早的评论
Hello. I'm trying to classify the color of each pixel using RGB values as red, yellow or blue. But the problem I have is that my classification for REDPIXEL includes colors: pure red/pink/reddish/red-orange and all those colors that look red or around that area to the human eye. SO, the range of the variance of RGB values is enormous. I've tried to classify using an approximate range for the color, but I'm sure I'm leaving out pixels & there must be a better way of doing this. My code is as follows:
img=imread('1.jpg'); %Reading the image I want to work on
RedPIXELS='1010-808kPa';%The classifications YellowPIXELS='700-600kPa'; BluePIXEL='270-0kPa';
img=imread('1.jpg');
for k=1:vidHeight-1 if img(k,k,1)>250 && img(k,k,1)-img(k,k,2)>100 && img(k,k,1)-img(k,k,3)>100
img(k,k)=RedPIXELS; if img(k,k,2)-img(k,k,1)<50 && img(k,k,3)<10 img(k,k)=YellowPIXELS; end
end
end
1 个评论
回答(0 个)
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!