Color Detection and Tracking Using USB cam
14 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I'm new to using the MATLAB tool, I'm enjoying it.
I would like the help of you to be able to make recognize colors, like red, through a USB camera. like this one: https://www.mathworks.com/help/vision/examples/face-detection-and-tracking-using-live-video-acquisition.html
Only in this he recognizes the face of people, I wanted with colors ... can you help me?
0 Commenti
Risposte (2)
Redha Reghioua
il 30 Set 2020
vid=videoinput('winvideo',1,'YUY2_320x240');
set(vid,'FramesPerTrigger',inf);
set(vid,'ReturnedColorspace','rgb');
vid.FrameGrabInterval=5;
start(vid);
while(vid.FramesAcquired<=100)
data=getsnapshot(vid);
diff_im=imsubtract(data(:,:,2),rgb2gray(data)); % 1= red, 2=green, 3= bleu
diff_im=medfilt2(diff_im,[3,3]);
diff_im=im2bw(diff_im,0.18);
diff_im=bwareaopen(diff_im,300);
bw=bwlabel(diff_im,8);
stats=regionprops(bw,'BoundingBox','Centroid');
imshow(data);
hold on
for(object=1:length(stats))
bb=stats(object).BoundingBox
bc=stats(object).Centroid
rectangle('Position',bb,'EdgeColor','r','LineWidth',2);
plot(bc(1),bc(2),'m+');
end
hold off
end
stop(vid);
flushdata(vid);
clear all
Image Analyst
il 5 Nov 2024 alle 4:07
See my attached video tracking demo where I track the movement of a green Sharpie marker.
0 Commenti
Vedere anche
Categorie
Scopri di più su Image Processing Toolbox in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!