Clear Filters
Clear Filters

edit-color detection

2 views (last 30 days)
FIR
FIR on 2 Mar 2012
I have a code for brown colour detection from that please tell how to detect for whit also,it shoul;d track both colour also,if brown colour is there it should trach it and even if white is there it should also track it
cform = makecform('srgb2lab');
J = applycform(I,cform);
%figure;imshow(J);
K=J(:,:,3);
%figure;imshow(K);
L=graythresh(J(:,:,3));
BW1=im2bw(J(:,:,3),L);
%figure;imshow(BW1);
M=graythresh(J(:,:,2));
%figure;imshow(J(:,:,2));
BW2=im2bw(J(:,:,2),M);
%figure;imshow(BW2);
O=BW1.*BW2;
% Bounding box
P=bwlabel(O,8);
BB=regionprops(P,'Boundingbox');
BB1=struct2cell(BB);
BB2=cell2mat(BB1);
[s1 s2]=size(BB2);

Answers (0)

Categories

Find more on Read, Write, and Modify Image in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!