File Exchange

image thumbnail

How to Detect and Track White Colored Object in LIVE Video

version 1.1.0.0 (2.15 KB) by Arindam Bose
This code shows how to detect and track white colored object in LIVE video using MATLAB.

14 Downloads

Updated 30 Jun 2016

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

Cite As

Arindam Bose (2020). How to Detect and Track White Colored Object in LIVE Video (https://www.mathworks.com/matlabcentral/fileexchange/40195-how-to-detect-and-track-white-colored-object-in-live-video), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (24)

Sarah Hui

Your code is so easy to understand and very well written!! Thank you!! Really helps me in the thesis I'm completing at the moment.

Sarah Hui

Nhu Lam

Hello, how can I detect in webcam of my laptop without using the camera? Please help me, thank you.

Mukundettan

Thank you

Prajwal Bangera

How to track black colour object instead of white?

juhaina alrajhi

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

Suryash Gautam

Please help to track a black coloured objects

Gede Harsemadi

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

thanks!

Bobby Satya

Jenisten Stark

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

@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);

Jenisten Stark

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

Rate this Submission

Jenisten Stark

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

erdal

Arindam Bose

@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.

Jenisten Stark

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

@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.

Jenisten Stark

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

Nice, Thanks a lot.

Fiem

Updates

1.1.0.0

Description changed

1.1.0.0

Description Changed

MATLAB Release Compatibility
Created with R2012a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired: WHITE OBJECT AREA DETECTION