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!