EN / USD
32
of 76
TEP , The Engineering Projects , Image

syedzainnasir

TEP , The Engineering Projects , Rating 7.5 7.5 / 10
TEP , The Engineering Projects , Icon Level: Moderator
TEP , The Engineering Projects , Icon Joined: 20 Mar 2022
TEP , The Engineering Projects , Icon Last Active: 2:21 PM
TEP , The Engineering Projects , Icon Location: TEP , The Engineering Projects , Flag
TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon
Motion Detection in Matlab
TEP , The Engineering Projects , Calender Question: 03-Mar-2017
TEP , The Engineering Projects , Category In: MATLAB Projects
hello guys!!..

can anyone teach me how motion detection done in matlab??
thanks..

or is there anyone who can give his or her code for that,,

Thank You..
TEP , The Engineering Projects , Icon Answer: 5 TEP , The Engineering Projects , Icon Views: 150 TEP , The Engineering Projects , Icon Followers: 85
Small Bio
TEP , The Engineering Projects , Image

adiono

TEP , The Engineering Projects , Rating 7.5 7.5 / 10
TEP , The Engineering Projects , Icon Level: Moderator
TEP , The Engineering Projects , Icon Joined: 20 Mar 2022
TEP , The Engineering Projects , Icon Last Active: 2:21 PM
TEP , The Engineering Projects , Icon Location: TEP , The Engineering Projects , Flag
TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon

RE:

Motion Detection in Matlab
TEP , The Engineering Projects , Calender Comment: 03-Mar-2017
TEP , The Engineering Projects , Category In: MATLAB Projects
[quote=Junaid_Shahid post_id=230 time=1488543419 user_id=48] [quote=Robinson post_id=229 time=1488543382 user_id=83] hello guys!!..

can anyone teach me how motion detection done in matlab??
thanks..

or is there anyone who can give his or her code for that,,

Thank You.. [/quote]
You have to detect motion in some video or how? kindly elaborate your problem [/quote]
the scenario is..
i will use a camera to human and then detect the human in the scene,,
by image subtraction..

how it process in matlab?
TEP , The Engineering Projects , Tick Correct Answer
Comment Bio
TEP , The Engineering Projects , Image

adiono

TEP , The Engineering Projects , Rating 7.5 7.5 / 10
TEP , The Engineering Projects , Icon Level: Moderator
TEP , The Engineering Projects , Icon Joined: 20 Mar 2022
TEP , The Engineering Projects , Icon Last Active: 2:21 PM
TEP , The Engineering Projects , Icon Location: TEP , The Engineering Projects , Flag
TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon

RE:

Motion Detection in Matlab
TEP , The Engineering Projects , Calender Comment: 03-Mar-2017
TEP , The Engineering Projects , Category In: MATLAB Projects
[quote=Robinson post_id=229 time=1488543382 user_id=83] hello guys!!..

can anyone teach me how motion detection done in matlab??
thanks..

or is there anyone who can give his or her code for that,,

Thank You.. [/quote]
You have to detect motion in some video or how? kindly elaborate your problem
TEP , The Engineering Projects , Tick Correct Answer
Comment Bio
TEP , The Engineering Projects , Image

adiono

TEP , The Engineering Projects , Rating 7.5 7.5 / 10
TEP , The Engineering Projects , Icon Level: Moderator
TEP , The Engineering Projects , Icon Joined: 20 Mar 2022
TEP , The Engineering Projects , Icon Last Active: 2:21 PM
TEP , The Engineering Projects , Icon Location: TEP , The Engineering Projects , Flag
TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon

RE:

Motion Detection in Matlab
TEP , The Engineering Projects , Calender Comment: 03-Mar-2017
TEP , The Engineering Projects , Category In: MATLAB Projects
[quote=Robinson post_id=231 time=1488543462 user_id=83] [quote=Junaid_Shahid post_id=230 time=1488543419 user_id=48] [quote=Robinson post_id=229 time=1488543382 user_id=83] hello guys!!..

can anyone teach me how motion detection done in matlab??
thanks..

or is there anyone who can give his or her code for that,,

Thank You.. [/quote]
You have to detect motion in some video or how? kindly elaborate your problem [/quote]
the scenario is..
i will use a camera to human and then detect the human in the scene,,
by image subtraction..

how it process in matlab? [/quote]
This is called block based matching technique. You have to divide the whole image in blocks. Then you have to compare sucessive blocks for any change with respect to some threshold which you ll set according to your application. If there is difference between successive blocks then motion is present otherwise not. I have done this thing couple of years ago.
TEP , The Engineering Projects , Tick Correct Answer
Comment Bio
TEP , The Engineering Projects , Image

adiono

TEP , The Engineering Projects , Rating 7.5 7.5 / 10
TEP , The Engineering Projects , Icon Level: Moderator
TEP , The Engineering Projects , Icon Joined: 20 Mar 2022
TEP , The Engineering Projects , Icon Last Active: 2:21 PM
TEP , The Engineering Projects , Icon Location: TEP , The Engineering Projects , Flag
TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon

RE:

Motion Detection in Matlab
TEP , The Engineering Projects , Calender Comment: 03-Mar-2017
TEP , The Engineering Projects , Category In: MATLAB Projects
[quote=Junaid_Shahid post_id=232 time=1488543516 user_id=48] [quote=Robinson post_id=231 time=1488543462 user_id=83] [quote=Junaid_Shahid post_id=230 time=1488543419 user_id=48]

You have to detect motion in some video or how? kindly elaborate your problem [/quote]
the scenario is..
i will use a camera to human and then detect the human in the scene,,
by image subtraction..

how it process in matlab? [/quote]
This is called block based matching technique. You have to divide the whole image in blocks. Then you have to compare sucessive blocks for any change with respect to some threshold which you ll set according to your application. If there is difference between successive blocks then motion is present otherwise not. I have done this thing couple of years ago. [/quote]
es,,i think its image subtraction..im planning to use that..but my problem is the algorithm that i will use in matlab..can you help me to make a code here..thank you
TEP , The Engineering Projects , Tick Correct Answer
Comment Bio
TEP , The Engineering Projects , Image

adiono

TEP , The Engineering Projects , Rating 7.5 7.5 / 10
TEP , The Engineering Projects , Icon Level: Moderator
TEP , The Engineering Projects , Icon Joined: 20 Mar 2022
TEP , The Engineering Projects , Icon Last Active: 2:21 PM
TEP , The Engineering Projects , Icon Location: TEP , The Engineering Projects , Flag
TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon

RE:

Motion Detection in Matlab
TEP , The Engineering Projects , Calender Comment: 03-Mar-2017
TEP , The Engineering Projects , Category In: MATLAB Projects
[quote=Robinson post_id=233 time=1488543556 user_id=83] [quote=Junaid_Shahid post_id=232 time=1488543516 user_id=48] [quote=Robinson post_id=231 time=1488543462 user_id=83]

the scenario is..
i will use a camera to human and then detect the human in the scene,,
by image subtraction..

how it process in matlab? [/quote]
This is called block based matching technique. You have to divide the whole image in blocks. Then you have to compare sucessive blocks for any change with respect to some threshold which you ll set according to your application. If there is difference between successive blocks then motion is present otherwise not. I have done this thing couple of years ago. [/quote]
es,,i think its image subtraction..im planning to use that..but my problem is the algorithm that i will use in matlab..can you help me to make a code here..thank you [/quote]
1- First of all you have to make sure that Video is read by Matlab. I do not know in which format you will make video with your camera. But I have done it with 'avi' format. In matlab command of 'aviread' will be used to read the video. you can search matlab help to find commands for other video formats. Lets for example you have saved your videofile(avi format) with name of 'filename' on your computer. Then how you will load it in matlab for further processing,here are some commands which will help you(you can see their details with matlab help)

video=aviread(’filename.avi’): read avi video into Matlab;
movie(video): play the movie with the file name ’video’
length(video): total number of frames in the video:
I=frame2im(video(j)): extract the jth frame from video to image I
size(I): determine the size of I, i.e., number of rows, columns, color or gray image
rgb2gray: convert an rgb image to a gray-scale image.
imwrite(I,filename,’bmp’): e.g. filename=’frame5’, then image named as ’frame5.bmp’ will be saved to the harddisk.

What you have achieved uptill now,you have loaded your 'Video'in matlab,played it via matlab. Then you have divided the whole video into frames and extracted each frame into image and saved it. Now you are ready to do further processing on these images to check the presence on motion.

2- Now load 2 consecutive images that you have saved in Step 1. Assigned the 2 images as 'Iold' and 'Inew' names, respectively.

Compute the difference between the 2 consecutive image frames (Idiff = Inew - Iold). Apply a fixed threshold to the difference image (i.e. Initially set a threshold value, e.g. th=50/255(or you can set any other threshold according to your needs)for image value ranges [0,1]). Set zeros to those pixels whose values are below the threshold (i.e. if |Idiff(i, j)| < threshold, then Idiff(i, j) = 0.0).

Divide the image area into rectangular blocks (size 16×16 or any size you want).Within each block indexed as (j, i), if there is one 'Idiff' value within the block containing the motion, then the block is assigned as a motion block, otherwise, it is a non motion block. Repeat this process over all blocks. Generate a
map image (same size as the original image) for indicating motion blocks and name it as ”Imotion”:for those pixels within the motion blocks, assign image values as 1.0, otherwise 0.0.

To search the whole image you can use the follwoing syntaxthe pixels within the block, having the block indexes (j,i), are
[(j - 1) * blocksize + 1 : j * blocksize, (i - 1) * blocksize + 1 : i * blocksize].
Check sum(sum(Idiff[ (j-1)*blocksize+1:j*blocksize, (i-1)*blocksize+1: i*blocksize]) for the motion inside the block.
Matlab functions useful to read image fiels are,

imread: read an image from a file
mat2gray: convert an image, from the pixel value range: [Imin,Imax] to a matrix image with a range [0.0 1.0].(Note: converting between image formats is very important for Matlab image processing.)When usng mat2gray, the image pixels extracted from video are usually 8 bits unsigned char (range between 0-255), while most Matlab processing requires pixels in float/double format. There are many other functions for image format conversion, e.g. ind2gray, gray2ind, rgb2gray. You can use Matlab’s help to find out more.

Now to check:Display 3 images: the 2 (original) consecutive images, and the motion image ”Imotion”. Observe the motion blocks, and change the threshold value th until the motion blocks indeed include all prominent changes in the image frames.

Plot ”Imotion” obtained in above step and observe whether or not the motion blocks cover most motion areas in the original image: if not, then change the threshold th value until ”Imotion” shows satisfactory motion areas. Its an hit an trial method. you have to do it untill u r satisifed with results.

So you have detected any motion in your Video using Matlab through Image subtraction(block based) technique.

Hope it help you.
Source:
[url=http://www.theengineeringprojects.com/2016/07/motion-detection-matlab.html]MOTION DETECTION IN MATLAB[/url]
TEP , The Engineering Projects , Tick Correct Answer
Comment Bio
TEP , The Engineering Projects , Tags
PLC
Robot
STM32
Arduino
AI
ESP32
Ladder Logic
PLC Projects
Programming
Communicates STM32
PLC Projects
Communicates PLC
Font Style
Alignment
Indenting and Lists
Insert Media
Insert Items

Want to leave an answer!

Word Count :0 Draft Saved at 12:42 am.