Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

How to classify the color of each pixel using its RGB values

1 Ansicht (letzte 30 Tage)
Anar Alshanbayeva
Anar Alshanbayeva am 17 Jan. 2016
Geschlossen: Walter Roberson am 17 Jan. 2016
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

Antworten (0)

Diese Frage ist geschlossen.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by