How to compute space-time gradients in video processing

7 views (last 30 days)
shab shekan
shab shekan on 28 Jun 2011
Hi guys, how can compute or examine the space-time gradients ∇Pi = (Pxi, Pyi, Pti ) of the intensity at each pixel within video frames? I realy need it.
  1 Comment
shab shekan
shab shekan on 11 Aug 2011
another way to compute space time gradient is
gradx1 = imfilter(seq,[-1 1] /2,'same');
grady1 = imfilter(seq,[-1 1]'/2,'same');
gradt1 = imfilter(seq,reshape([-1 1],[1 1 2])/2,'same');
seq is a space-time patch (stpatch) from video file around a pixel with size 7*7*3.
But I have problem in gradt1. if you run this filters on simple 3D matrix, you will find out that gradt1(:,:,3) is very different against gradt1(:,:,1) and gradt1(:,:,2).
and it makes me in crazy.
I found this code in net, and nobody answere me on there.
please check this code and analyze this code, and explain to me. I can understand how does it compute temporal gradient(gradt)?
If it need change to compute 7*7*3 volume, please tell me.

Sign in to comment.

Answers (2)

David Young
David Young on 28 Jun 2011
The issue with image gradients is usually how much smoothing of the image data to do. This is a question not just of the noise in the images, but also of the spatial and temporal scales at which you want to estimate the gradients. You may well have to experiment with smoothing techniques and their associated parameters to get a useful result.
If you are happy to estimate the temporal gradient from only a pair of frames (more precise estimation methods may use more than 2 frames), and you are happy with Gaussian smoothing, then you could use the function gradients_xyt from this FEX contribution.
  1 Comment
shab shekan
shab shekan on 2 Jul 2011
Thank you David,that's great, it solved my problem.I check it few minutes after you answere, but I forgote to appreciate.

Sign in to comment.

Sean de Wolski
Sean de Wolski on 28 Jun 2011
doc gradient

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!