MATLAB: Blue colour range in hsv saturation system

hsv

I'm trying to increase the intensity of blue pixels in an RGB image and I'm trying to increase the blue only pixel intensity, for example if I have:
imghsv=rgb2hsv(img);
imgs=imghsv(:,:,2);
I roughly set a condition for the blue range
imgs(ii,jj) >0.1 && imgs(ii,jj)<0.4
but I found out some yellow pixels are also enhanced.
I think I might missing something, is there another way where I can enhance the blue colours only in an image?
Thanks!

Best Answer

Hum!, the Hue channel (the one that contains the colour information) in a HSV image is the first one.
The limits of the blue hue depends on what you call blue, but it's in the region of 0.5 to 0.7.
So:
imghsv=rgb2hsv(img);
imgh=imghsv(:,:,2);
bluepixels = imgh >= 0.5 & imgh <= 0.7;
The saturation (2nd channel) is completely independent of the hue. You may want to filter pixels with very low saturation as they'll look almost black but it certainly won't help filtering out yellow (or green, or red, or any other colour)