Color Blue is not getting detected

4 vues (au cours des 30 derniers jours)
Emmanuel
Emmanuel le 13 Juin 2014
Commenté : Emmanuel le 1 Juil 2014
Hi all! I am tracking R,G and B colors and the threshold value I have given to blue is 0.15 and its not getting detected and tracked. I use a dark blue marker. Can you please help me out with thids?

Réponses (1)

Image Analyst
Image Analyst le 13 Juin 2014
Try adjusting the thresholds or use a different color space. See my color segmentation demos in my File Exchange: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862. Post an image you're having trouble with along with your blue detection code in a simple script designed to work on that image.
  1 commentaire
Emmanuel
Emmanuel le 1 Juil 2014
Hi..Sorry for the late reply!
diffblue = imsubtract(data(:,:,3),rgb2gray(data));
diffblue2 = imsubtract(data2(:,:,3),rgb2gray(data2));
diffblue = im2bw(diffblue, 0.15);
diffblue2 = im2bw(diffblue2, 0.15);
diffblue = bwareaopen(diffblue , 300);
diffblue2 = bwareaopen(diffblue2 , 300);
bwblue = bwlabel(diffblue , 8);
bwblue2 = bwlabel(diffblue2 , 8);
statsblue = regionprops(bwblue, 'BoundingBox', 'Centroid');
statsblue2 = regionprops(bwblue2, 'BoundingBox', 'Centroid');
The bounded boxes are detected by right camera and dotted boxes by left camera.Here you can see that I have to use external light and make sure that this light doesn't fall on red, otherwise, red goes undetected and threshold for red is 0.18. Please help me as to how can I reduce the dependency of external light and what kind of threshold will be apt for blue?

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by