File Exchange

image thumbnail

How to Detect and Track White Colored Object in LIVE Video

version 1.1 (2.15 KB) by

This code shows how to detect and track white colored object in LIVE video using MATLAB.

4.71429
8 Ratings

30 Downloads

Updated

View License

This code shows how to detect and track white colored object in LIVE video using MATLAB.
For deteil documentation please refer to:
http://arindambose.com/?p=609
For video tutorial please refer to:
http://youtu.be/okgwdRvwxgw

Comments and Ratings (19)

how to convert it to simulink ?

hani alsareti

vidDevice = imaq.VideoDevice('winvideo', 1, 'YUY2_1280x720', ... % Acquire input video stream 'ROI', [1 1 640 480], ... 'ReturnedColorSpace', 'rgb'); i have an error in code it says undefined variable "imaq" or class "imaq.videoDevice"
i am using R2010a version and i am using windows 7
 

Please help to track a black coloured objects

Hello,
can you explain me for this :

Undefined variable "vision" or class "vision.BlobAnalysis".

Error in white (line 14)
hblob = vision.BlobAnalysis('AreaOutputPort', false, ... % Set blob analysis
handling

i'm stuck with it, kindly please help me :)

Siya reddy

Hello, I tried to run this code but constantly an error occurs saying there is an error in this line::
Error: rgbFrame = step(vidDevice);
and also i get this which i am unable to resolve::
Error in tempdir (line 31)
curr_dir = cd(tmp_dir);
 and I checked all along the code evrything seems fine. Could you let me know what should I do?

HD

HD (view profile)

thanks!

Bobby Satya

Ya thanks dude. It worked.. :)
Now If need to change the color of the detected white objects into grey color of some other rgb colors format, what should i do???.
Are there any possibilities to do such type of processing. ???
 

Arindam Bose

Arindam Bose (view profile)

@Jenisten Stark: Yes, surely. You have to release the video input handle. In this case put the following line at the end of your code.
release(vidDevice);

one more help dude... My webcam's still on even if i finish running ur code also. so i had to close matlab completely and then again start it fresh...
So is der any command or code to stop this process alone without closing matlab completely..

Emily

Emily (view profile)

Rate this Submission

Matlab R2012a works awsum... !!!
Thank u for ur guidance dude...

erdal

erdal (view profile)

Arindam Bose

Arindam Bose (view profile)

@Jenisten Stark: From R2012a onward Image Acquisition Toolbox handles are prefixed by imaq.. So if you are using R2009 version, try to use videoinput('winvideo',1,'YUY2_640x480')
Probably it will fix the problem.
But still you don't have Computer Vision Toolbox. So its better to upgrade your version.

Thank U For ur reply dude... And Actually, I've got imaq tool box. I used this tool and then only set the video input command to YUY2_640x480 resolution.
But Computer Vision System Toolbox is missing in my version. Is it possible to download that tool box alone or should i change the version for using it??

Arindam Bose

Arindam Bose (view profile)

@Jenisten Stark: Its showing the error because in your MATLAB version, 'Image Acquisition Toolbox' is not available. The word 'imaq' stands for 'Image Acquisition Toolbox'.
Probably you don't have 'Computer Vision Toolbox' as well. The word 'vision' stands for it.
These toolbox are included in MATLAB R2012a onward.

I'm using R 2009 version and it shows
following error::::
---------------------------------------
??? Undefined variable "imaq" or class "imaq.VideoDevice".

Error in ==> white at 10
vidDevice = imaq.VideoDevice('winvideo', 1, 'YUY2_640x480', ... %
Acquire input video stream
----------------------------------------
Think some tool boxes are missing in this version.
What tool boxes are required for this program...

Fiem

Fiem (view profile)

Nice, Thanks a lot.

Fiem

Fiem (view profile)

Updates

1.1

Description changed

1.1

Description Changed

MATLAB Release
MATLAB 7.14 (R2012a)
Acknowledgements

Inspired: WHITE OBJECT AREA DETECTION

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video