Color Detection and Tracking Using USB cam
14 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (2)
Redha Reghioua
el 30 de Sept. de 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
el 5 de Nov. de 2024 a las 4:07
See my attached video tracking demo where I track the movement of a green Sharpie marker.
0 comentarios
Ver también
Categorías
Más información sobre Image Processing Toolbox en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!