Color Blue is not getting detected

4 次查看(过去 30 天)
Emmanuel
Emmanuel 2014-6-13
评论: Emmanuel 2014-7-1
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?

回答(1 个)

Image Analyst
Image Analyst 2014-6-13
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 个评论
Emmanuel
Emmanuel 2014-7-1
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?

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by