Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

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

1 vue (au cours des 30 derniers jours)
Anar Alshanbayeva
Anar Alshanbayeva le 17 Jan 2016
Clôturé : Walter Roberson le 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

Réponses (0)

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by