i want to display the coordinates of the centroid of the red components in video..uptil i have done the following code:

a = imaqhwinfo; [camera_name, camera_id, format] = getCameraInfo(a); vid = videoinput(camera_name, camera_id, format); set(vid, 'FramesPerTrigger', Inf); set(vid, 'ReturnedColorspace', 'rgb') vid.FrameGrabInterval = 1; start(vid) while(vid.FramesAcquired<=100) data = getsnapshot(vid); diff_im = imsubtract(data(:,:,1), rgb2gray(data)); diff_im = medfilt2(diff_im, [3 3]); diff_im = im2bw(diff_im,0.17); diff_im = bwareaopen(diff_im,300); stats = regionprops(bw, 'Centroid');

Réponses (1)

OK. Do you have a question? To display coordinates you can use fprintf(), msgbox(), helpdlg(), or use sprintf() and set() to send a string to a label in your GUI.
There are File Exchange submissions on this. And for what it's worth, attached is my demo for tracking a green Sharpie marker in a video.

Catégories

En savoir plus sur MATLAB dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by