i want to display the coordinates of the centroid of the red components in video..uptil i have done the following code:
2 views (last 30 days)
Show older comments
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');
0 Comments
Answers (1)
Image Analyst
on 26 Apr 2015
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.
0 Comments
See Also
Categories
Find more on Camera Views in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!