Generating view file from camera calibration

Hi

I was wondering if someone knows how to generate a view file in Radiance, given real life
camera calibration parameters. I've created a scene and view file in Radiance and I'm now trying to create the exact geometric model in real life.

I have the focal length and image resolution, so can compute the -vh and -vv angle values but the main problem is trying to compute the -vp and -vd parameters.

I have the 3x3 Rotation matrix and 3x1 Translation vector from using the Bouget Camera Calibration Toolbox in Matlab. The axes are the same as for my Radiance scene but I need to translate the camera reference frame origin to the geometric world scene origin.

Also I'd like to know how to do the Rotation as well for other images I have whereby after calibration, the axes may not be aligned.
I've been looking in a few books but find some things ambiguous and getting a bit confused, so just wondering if somebody has a quick solution.

I've considered 'cheating' by re-writing the geometry in the .rad file so that the camera reference frame origin is at the geometric world origin, but I'd prefer not to do this.

Any help is greatly appreciated

Thanks

Tarik

···

--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

Hi Tarik,

I should be able to help you. From what you are writing I have been through many of the same things. I have used the Bouget calibration toolbox some years ago, so I have forgotten the details. I am presently using my own matlab based calibration tool, but the process of making a link to Radiance should be the same.

What I have done is to make a simple Matlab script which auto-generates a Radiance view file (.vp). Here is an example of the output from my script for a given image where I have calibrated the camera to a checker-board in the image:

rview -vtv -vp -2.555731 -1.572937 1.778183 -vd 0.807129 0.430026 -0.404500 -vu 0.359249 0.185955 0.914527 -vh 45.809853 -vv 31.486144

As stated: I have forgotten Bouget calibration details, but if you have the 3x3 rotation and the 3x1 translation you are all set to go. In what I am writing I am assuming that the rotation and translation information constitutes transformation from world to camera (not vice versa).

I my code I have the world to camera transformation as a 4x4 matrix, where the upper left 3x3 is the rotation, and the upper three elements of the left-most column is the translation vector (standard transformation matrix in homogenuous coordinates).

Here is my Matlab code that autogenerates the .vp file:

···

--------------------------------------------------------------------------------------

%world2cam is a 4x4 transformation from world to camera coordinates
%
%focallength_in_pixels is the estimated camera focal length measured in pixels (it may be a negative number
%in the Bouget toolbox ... in that case multiply by -1 in the expressions below)

%inverse to get camera to world transformation
cam2world = inv(world2cam);

%save camera parameters in a format directly applicable
%for RADIANCE rendering engine
camfilename = strcat(path,'CAMERA.vp');
fid = fopen(camfilename, 'w');
fprintf(fid, 'rview -vtv ');
fprintf(fid, '-vp %.6f %.6f %.6f ', cam2world(1:3,4));
fprintf(fid, '-vd %.6f %.6f %.6f ', -world2cam(3,1:3));
fprintf(fid, '-vu %.6f %.6f %.6f ', world2cam(2,1:3));
fprintf(fid, '-vh %.6f ', rad2deg(2*atan2(0.5*xres, focallength_in_pixels)));
fprintf(fid, '-vv %.6f\n', rad2deg(2*atan2(0.5*yres, focallength_in_pixels)));
fclose(fid);

------------------------------------------------------------------------------------------------------

The part in your mail that concerns multiple images and axes that are not aligned I do not understand so I can't assist on that.

Sincerely,
Claus

P.S. I have the same exporting facility generating a MAXscript that will set up a matched camera in 3D studio max, but max has built-in camera matching.

[email protected] wrote:

Hi

I was wondering if someone knows how to generate a view file in Radiance, given real life
camera calibration parameters. I've created a scene and view file in Radiance and I'm now trying to create the exact geometric model in real life.

I have the focal length and image resolution, so can compute the -vh and -vv angle values but the main problem is trying to compute the -vp and -vd parameters.

I have the 3x3 Rotation matrix and 3x1 Translation vector from using the Bouget Camera Calibration Toolbox in Matlab. The axes are the same as for my Radiance scene but I need to translate the camera reference frame origin to the geometric world scene origin.

Also I'd like to know how to do the Rotation as well for other images I have whereby after calibration, the axes may not be aligned.
I've been looking in a few books but find some things ambiguous and getting a bit confused, so just wondering if somebody has a quick solution.

I've considered 'cheating' by re-writing the geometry in the .rad file so that the camera reference frame origin is at the geometric world origin, but I'd prefer not to do this.

Any help is greatly appreciated

Thanks

Tarik

If you have a nice perspective image you could try the 'match photo' feature in SketchUp:

Only works for smaller values of 'exact', though.

Thomas

···

On 25 Sep 2008, at 11:59, [email protected] wrote:

Hi

I was wondering if someone knows how to generate a view file in Radiance, given real life
camera calibration parameters. I've created a scene and view file in Radiance and I'm now trying to create the exact geometric model in real life.

I've considered 'cheating' by re-writing the geometry in the .rad file
so that the camera reference frame origin is at the geometric world
origin, but I'd prefer not to do this.

Just in case that you do this - do not rewrite the geometry but use an xform-statement to transform the scene. Still this is not really useful for animations, and I guess there have been enough hints for generating the view points now - so this is just for completeness :wink:

Have a nice week-end!

Lars.