MATLAB Answers


Image Transformation using Parallel Processing / GPU

Asked by Sam
on 23 Jan 2013

Hello all,

I am wondering if it's possible to perform a transformation on two matrices (in my case two images) at the same time, i.e. by using parallel processing or utilising the power of the GPU. I am attempting to transform two video streams (continuously updated images) with two unchanging transformation matrices at the same time. I'm not looking for a solution, just if I'm either barking mad or on the right track.



Log in to comment.

2 Answers

Answer by Matt J
on 23 Jan 2013

Should be possible with PARFOR

parfor j=1:2

but if there are only 2, it seems like small gains. You could also try to cut up the resampling coordinates into N parallel chunks

parfor i=1:N
 for j=1:2

The problem there is that multiple workers would require access to the image data V{j} and, in my experience, a lot of the gains can be lost as the images are cloned and broadcast to the workers.

If you have Jacket (they're in the process of merging into Matlab), it has GPU support for INTERP2, and GPUs are better at sharing global data among workers, i.e., the image data won't have to be cloned. However, there is longer broadcasting time to GPUs and it's not clear how much that would hurt you. The GPU would be ideal if you are planning to do many transformations to the same images. Then the broadcasting becomes a 1-time startup cost.

  1 Comment

I was just looking for some food for thought - many thanks for your input. I should rephrase my original question: I am looking to transform two video streams (continuously updated images) with an unchanging transformation matrix. I did look into Jacket, it looks like a nice bit of software!

I am in the process of researching this and just wanted to clarify I wasn't wasting my time. Thanks again!

Log in to comment.

Answer by Jurgen
on 23 Jan 2013


Log in to comment.

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!