View License

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

» Watch video

Join the 15-year community celebration.

Play games and win prizes!

» Learn more

4.3 | 25 ratings Rate this file 143 Downloads (last 30 days) File Size: 1.14 MB File ID: #18151 Version: 1.3
image thumbnail

Motion Detection in a video



28 Dec 2007 (Updated )

motion detection in a video or live objects

| Watch this File

File Information

this programs identifies the moving objects in a video ( continious frames) and displays the moving object in a window.

when you execute this code just check whether the input video is supported in matlab r not. so for the testing i am attaching a zip file which contains the code and sample video that i have found in internet.

i am checking it regularly dont know if u r having problem in it


This file inspired Intellicam(Real Time Moving Object Tracker).

Required Products Image Acquisition Toolbox
Image Processing Toolbox
MATLAB release MATLAB 7.4 (R2007a)
Other requirements u can also use this code as algorithm for other programming environments as i have used very less matlab functions.
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (50)
03 Oct 2016 Vijaykumar Modi

Iam getting error as follow when execute the code,
"Cell contents reference from a non-cell array object."
Iam using MatLab 2012a
please help me out

Comment only
03 Dec 2015 divya marudhavanan

Im doing my project in video processing,based on the recognition of actions by the humans.So,i have to box rectangle for each part of the body of the human.For example hands,legs,head...if anyone knows based on this,could you please help me for the code.

Comment only
28 Apr 2015 fu yun

fu yun (view profile)

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

Comment only
06 Jul 2014 Gizem

Gizem (view profile)

11 Feb 2014 Logaprabhavathy  
02 Mar 2013 mansouri

same problem as 536 blog. please give me the solution please!!

02 Mar 2013 mansouri

hello when I run the project it returns me an error "Error using ==> run at 5
The file Requires the Following codec (s) to be installed on your system:
Indeo5 "I installed Indeo 5 but it is not compatible! can you help me please and tell me how I can do that the program runs smoothly. Thanks in advance

Comment only
05 Feb 2013 CHEN

CHEN (view profile)

I can't download this file.

Comment only
23 Nov 2012 rami

rami (view profile)

To read the video, convert it to wmv then try reading it in Matlab with:
objreader = mmreader(video);
vidFrames = read(objreader,[1 80]);

Comment only
23 Nov 2012 chitesh dewangan

When I try and run it with the sample video I get the error "??? Error using ==> run at 5. Initialization failed. (No combination of intermediate filters could be found to make the connection)." and with other video another problem is an error ''disp (toplen)" it is not tracking though it taking input in the loop its not taking the value of toplen....and also help me if this code can be used for real time object tracking......

02 Sep 2012 sunil

sunil (view profile)

same problem as 536 blog. please give me the solution...

23 Dec 2011 rami

rami (view profile)

Same problem as blog 536. Any solution ?

Comment only
12 Dec 2011 Megha Shesha  
03 Dec 2011 blog 536  
03 Dec 2011 blog 536

Sir i have downloaded the code and run it in matlab 7.8 (R2009a). it gives me the following error, can u correct it plzz ???

>> run
input video
??? Error using ==> aviread at 73
Unable to locate decompressor Indeo5 to decompress video stream.
See Mathworks Technical Solution 1-4G50QZ for more info.

Error in ==> run at 5
avi = aviread('samplevideo.avi');


Comment only
20 Nov 2011 Balamurali

Can you please send the details of this project to my mail

Comment only
18 Nov 2011 ben

ben (view profile)

Plz, I can't download this file.

Comment only
18 Nov 2011 ben

ben (view profile)

Plz, I can't download this file.

Comment only
15 Nov 2011 Jennifer

When I try and run it with the sample video I get the error "??? Error using ==> run at 5. Initialization failed. (No combination of intermediate filters could be found to make the connection)."

Anyone know what the cause is?

Comment only
23 Sep 2011 Meenu

Meenu (view profile)

Sir I have to track cars in the vediowhose back ground is not static... i am going to simulate in SCILAB... i am planning to follow your proposed algorithm... will it works for that... I tried to simulate in matlab 2009... but getting some error (reshape should contain same number of arguments always )

Comment only
23 May 2011 Dhanushka Herath  
07 Apr 2011 Nikolay S.

Nikolay S. (view profile)

While I appreciate the submitting, I must say the code fails to work, and is written in a non effective manner (memory utilization, repeating code, not commented, with many commented out lines). I'm working a while here to make it run :(

09 Jan 2011 Manjunath NM

Gr8 work, but i have problem with the aviread function. I'm using Matlab R2008b
kindly help.

Comment only
10 Nov 2010 Saša Mandi?

I need an algorithm which detect motion (face, arm, leg, etc.) - ROI in video!
If anybody have or know how to write it please contact me on my e mail!
I need to do this for my work an collage but i don't know how to write it!
Thank you very much!

Comment only
10 Oct 2010 karim Budabuss

,thank you for keeping such a good project.I wanted it to implement it with real video captured by live web cam. Is it possible you to send me the code or guide me about how to change the code, also can u send me some explanation of the algorithm you used. email:

09 Aug 2010 Mohamed Ali Alaswed  
25 Feb 2010 M

M (view profile)

hi ,
i am new in MaTlab arena.....and i am interested about it. Now i m doing a coursework on Multimedea systems. Could any one tell me please how can I get segments the moving object and that superimposes each object its bounding box. Let me know in detail please. I am waiting for response.

thanx very much indeed.

Comment only
11 Jan 2010 Deepu aaa

Hello sir,thank you for keeping such a wonderful project which will help to beginners like me.I wanted it to implement it with real video captured by live web cam. Is it possible you to send me the code or guide me about how to change the code

11 Jan 2010 tic

tic (view profile)

06 Oct 2009 rimie asaari

Hi, could you recomend the suitable video codec that can work well with this matlab. i am trying to execute the code, but having problem with the codec. thanks..

Comment only
05 Oct 2009 Jimmy

Jimmy (view profile)

Hey, I just saw your post. The job you've done is excellent. I am doing a project which aim is to identify the position and sizes of cells in images and track these cells over a movie sequence. Can you give me some ideas and help of how to implement it. My e-mail is Thank you

Comment only
02 Jun 2009 Shima

Shima (view profile)

Hi, thank you for sharing your code.I executed it and it worked very well. For my project I need a real-time motion detection for the video from my webcam. Is it possible for you to send me the code or to guide me on how to change the code? I thank you in advance.
my email is " "

09 May 2009 kiran malik

Hi Sir ;its realy great. I'm doing a project on this topic so i need your help if you can send me the details about its working and about how to track the moving object in the video. In short if you can send me a description of the algoritham that how its working , i'l be very much obliged .you can send it on thanks

Comment only
26 Dec 2008 ashok p

hai sir it works well.This will helpful for my project.can u send details of the

22 Nov 2008 Jim Petter

It's very grateful to download your demo,which is very useful for me!Thank you very much.However,after I read the code,I don't know the basic principle for you to track the target.Can you send the details of how it is working..
my email id

Comment only
21 Nov 2008 Arun sr

hai sir it so gud....
working very well
i would like to do it as my project..
can you send me the details of how it is working..
my email id

22 Oct 2008 Xu FengLiang

i am very appreciate yours sharing.
and hope you give me a explain about what is the result numbers mean

05 Oct 2008 chiru jeeva

fine...... needs more....

23 Sep 2008 santhosh kumar kadarla

sir thank u for keeping such a good project code in user available website....I am doing a project on real time object tracking in video images using C language..and I am trying to do it in real time (using live video) and hardware kit (IDK) interface with these kits I need the code to be written in C language so I am facing problem in writing the code in C wich is necessary for Code composer studio .....I thnk u may know about all these things.....can u help me sir......further

24 Jun 2008 zeshan ahmed

its a good code u have written , but the problem i am facin g is while interfacing it with live camera it gives an error ''disp (toplen)" it is not tracking though it taking input video... Can you help me with this? and whether u have tested your code for live videos using webcams...i will be really great full if u mial me for your reply

11 Jun 2008 Norman V


03 Jun 2008 Lukas junior

This is great Program, bath how can describe hoh working exactly this Motion detecion becasue I don`t understand this source soube

24 May 2008 manos komninos

i can t work with video 640x480 why?

26 Feb 2008 tr l

good, thank you!
but the limitation is that it can only track one moving object and the background should be still.

Comment only
06 Feb 2008 Amrita M

Good Project...have u tried this one with real-time video input??

26 Jan 2008 Nguyen Quang

You may miss some m.files,could you up load again?
Thank you!

19 Jan 2008 Satyendra Mishra

good project

Comment only
03 Jan 2008 Michalis Vousdoukas

Code is empty! Please try uploading again...

Comment only
02 Jan 2008 Eryanto Prabowo

I can't download this file

Comment only
02 Jan 2008 Joseph Hollmann

The link to the code does not appear to be working.

Comment only
03 Jan 2008

sorry for the inconvience. i have updated the files. check it now

28 Jan 2008

Updated to such that can be implemented in any language as i have used very few matlab function.

24 Aug 2009 1.3

I have updated the code with a project report with other software. But the basic structure of the project report submitted is from matlab and can be help ful during the lab work

Contact us