5.0

5.0 | 2 ratings Rate this file 39 Downloads (last 30 days) File Size: 169.49 KB File ID: #15767

Fast Motion Detection(bugs fixed)

by Arash Jalalian

 

01 Aug 2007 (Updated 01 Aug 2007)

this script used a new fast block matching algorithm with dynamic search patterns to obtain motion v

| Watch this File

File Information
Description

this script used a new fast block matching algorithm with dynamic search patterns to obtain motion vectors for each blocks.
[rep_motion motion_vector] = fastMV(im1, im2, w)
1. check with big diamond.
2. check with one of the hexagon subject to previous results.
3. check with small diamond.
'im1' is base frame of a video and 'im2' is the second frame. and 'w' is
the window size. 'rep_motion' is the representative motion vector and
'motion_vector' declare motion vectors for each block of image.
Example:
im1 = imread('frame001.jpg');
im2 = imread('frame002.jpg');
w = 16;
[rep_m m_vector] = fastMV(im1, im2, w);
files: fastMV.m, frame01.pgm, frame02.pgm

Required Products Image Processing Toolbox
MATLAB release MATLAB 7.4 (R2007a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
17 Jun 2010 w w  
08 Sep 2010 Abel roc

Analaozing this file, I found that the calculations of the differences between the reference Macro Block and his neihgborhoods, sometimes the difference between pixels are zero but the pixels are not the same. I explain it better in an example.

on line 77

 diff.diam1{1, k} = abs(slice1{i, j}- im2(s_h_r + pat.diam1(1, k):...
                    i *w + pat.diam1(1, k),...
                    s_h_c + pat.diam1(2, k):...
                    j * w + pat.diam1(2, k)));

if for exemple slice{1,j} = [255 128]
and im2 of the seleced pixels is im2(...)=[255 255]
Then the difference in the fastMV.m file is
diff.diam1{1,k} = [0 0]
and if I'm not wrong this would be
diff.diam1{1,k} = [0 127]

I think that this happens because uint8 doesn't admit negative numbers and the difference (before the abs function) is negative and it aproximates it to 0.

I don't know if it is known and is correct for the algoritm or there is a mistake.

Thanks.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
image analysis Arash Jalalian 22 Oct 2008 09:21:23
motion detection Arash Jalalian 22 Oct 2008 09:21:23
motion vector Arash Jalalian 22 Oct 2008 09:21:23
mpeg Arash Jalalian 22 Oct 2008 09:21:23
block matching Arash Jalalian 22 Oct 2008 09:21:23
bma Arash Jalalian 22 Oct 2008 09:21:23
block matching Boris Feinstein 02 Dec 2008 09:32:03
motion detection Boris Feinstein 02 Dec 2008 09:32:05
block matching noura noura 15 Jan 2009 03:11:43
block matching w w 17 Jun 2010 09:32:45
block matching Michael Merten 16 May 2011 05:56:33
block matching Muhammad Mubashir 14 Jun 2011 08:50:18

Contact us at files@mathworks.com