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

Thread Subject:
Fitting and distorting images in 3D

Subject: Fitting and distorting images in 3D

From: Yael

Date: 17 Dec, 2010 12:40:09

Message: 1 of 4

I have 2 video cameras- one is fixed on the ceiling and the second is moving with the subject. They both film the same scene. I also have a device which tracks the 3-d position and orientation of the hand holding the camera.
I would like to find the best fitting of each frame from the hand to the frame from the ceiling camera.
Therefore, I'm trying to distort each frame from the hand camera (rotation and translation) so it will best fit the frames from the fixed ceiling camera.

I've tried the following toolboxes:
1) Image & Video toolbox (by Piotr Dollar) - we could not figure out how to use it. There is a variable called Z-Value even Piotr said he cannot remember what it means.
2) Image Processing toolbox - in the X and Y axes, the 3D distortion isn't working right.

Has anyone solved such a problem and can help (using these toolboxes or others)? Do you know about a toolbox or functions that can solve this distortion problem?

Thank you,
Yael

Subject: Fitting and distorting images in 3D

From: Sean de

Date: 17 Dec, 2010 13:58:05

Message: 2 of 4

"Yael " <yaelzilb@gmail.com> wrote in message <iefln9$ksg$1@fred.mathworks.com>...
> I have 2 video cameras- one is fixed on the ceiling and the second is moving with the subject. They both film the same scene. I also have a device which tracks the 3-d position and orientation of the hand holding the camera.
> I would like to find the best fitting of each frame from the hand to the frame from the ceiling camera.
> Therefore, I'm trying to distort each frame from the hand camera (rotation and translation) so it will best fit the frames from the fixed ceiling camera.
>
> I've tried the following toolboxes:
> 1) Image & Video toolbox (by Piotr Dollar) - we could not figure out how to use it. There is a variable called Z-Value even Piotr said he cannot remember what it means.
> 2) Image Processing toolbox - in the X and Y axes, the 3D distortion isn't working right.
>
> Has anyone solved such a problem and can help (using these toolboxes or others)? Do you know about a toolbox or functions that can solve this distortion problem?
>
> Thank you,
> Yael

What have you tried with the MATLAB-IPT? Have you seen IMTRANSFORM?

Subject: Fitting and distorting images in 3D

From: Yael

Date: 19 Dec, 2010 10:59:05

Message: 3 of 4

I have tried to use the "imtransform" function from MATLAB-IPT and it works great with distortion in the z axis but not in the y or x axis, and I don't understand why...
Here are some lines from my code (for y axis for example):

degrees = 1;
radians = pi*degrees/180;
 
% Rtest = rotationmat3D(radians,[0 1 0]);
Rtest = rotationMatrix(0, radians, 0);
%both functions- "rotationmat3" and rotationMatrix give the same result

T = maketform('projective',Rtest);
[imageAfterRot,xdata,ydata] = imtransform(myImage, T, 'bicubic', 'size', [480 640]);
 
figure, imshow(imageAfterRot); title('with rotate-y');

Do you have any ideas?
Thank you!
Yael

Subject: Fitting and distorting images in 3D

From: Matt J

Date: 19 Dec, 2010 14:28:04

Message: 4 of 4

"Yael " <yaelzilb@gmail.com> wrote in message <iekohp$e6i$1@fred.mathworks.com>...
>
> % Rtest = rotationmat3D(radians,[0 1 0]);
> Rtest = rotationMatrix(0, radians, 0);
> %both functions- "rotationmat3" and rotationMatrix give the same result
>
> T = maketform('projective',Rtest);
> [imageAfterRot,xdata,ydata] = imtransform(myImage, T, 'bicubic', 'size', [480 640]);
======

When you call T=maketform('projective',A), the matrix A is not meant to be a 3D rotation matrix. It is meant to be a projective transformation (see "doc maketform")

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us