MATLAB: Find yellow pixels in an image

image analysisimage processingMATLAB

So I have an image, jpg file, which means it is RGB?
I want to find out how many pixels are yellow, the following code is what I have now. Shouldn't be too hard except I don't know the syntax
img=imread('MyImage');
[a,b,c]=size(img);
count_y=0;
for i=1:a
for j=1:b
if img(a,b)==yellow %%% How do I write this line??
count_y=count_y+1;
end
end
end
Thanks folks!

Best Answer

Use the Color Thresholder on the Apps tab of the tool ribbon. Select HSV color space and load your image then select thresholds and then export the function.
Related Question