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