POV-Ray : Newsgroups : povray.pov4.discussion.general : camera calibration Server Time
28 Mar 2024 05:01:55 EDT (-0400)
  camera calibration (Message 1 to 3 of 3)  
From: StudentPHD
Subject: camera calibration
Date: 13 Mar 2013 17:45:01
Message: <web.5140f2fb88b7d8b035064a200@news.povray.org>
Hello,


I am developping an application on povray to generate an images to to use them
to test my  algorithm of 3D reconstruction.

MY configuration is like this:
  camera {
                     location<0,0,0>

                   sky <0,1,0>
                   up <0,1,0>
                   right<1,0,0>
                   direction <0, 0, 1>*0.1
                   angle 90
                   rotate <40,-45,0>
                   translate<300, 250, -300>
                   look_at <0,0,1>

                }

I define 100 povray unit to be 1m, it means that 1 povray unit be 1cm.  I need
to calibrate camera. It means  ,I need to get the internal and external
parameters.


External parameters is very simple: matrix rotation R=
[rotx(40),roty(-45),rotz(0)]. The translation is the center of camera(location )
T=[300,250,-300].

My problem is about the matrix K of internal parameters(3 by 3). It means the
focal, size of pixel(is square or not?),...


And Finally, I need the model used by povray to project the 3D point. I know
that I use a perspective type of projetion but . There many manner to calculate
the matrix of camera. like P=  k*[R T] , P=K*[R -R*T]. I need to know which
model the pov ray software uses ?


Thanks to help me.


Post a reply to this message

From: clipka
Subject: Re: camera calibration
Date: 14 Mar 2013 07:02:48
Message: <5141ae58$1@news.povray.org>
Am 13.03.2013 22:43, schrieb StudentPHD:

> My problem is about the matrix K of internal parameters(3 by 3). It means the
> focal, size of pixel(is square or not?),...
>
> And Finally, I need the model used by povray to project the 3D point. I know
> that I use a perspective type of projetion but . There many manner to calculate
> the matrix of camera. like P=  k*[R T] , P=K*[R -R*T]. I need to know which
> model the pov ray software uses ?

The standard camera model used by POV-Ray is a simple pinhole camera, 
with the pinhole being located exactly at the camera's nominal location.

The way you specified the camera (with an explicit angle), the camera is 
presumed to have a distane between the "film" and the "lens" of 1 
POV-Ray unit, and the "film" is supposed to have a size of tan(angle) by 
tan(angle)*|up|/|right| POV-Ray units, divided into image_width by 
image_height pixels.

If using focal blur, the camera is presumed to have a simple lens 
instead of a pinhole, focusing the plane at a distance of 
|focal_point-location| onto the "film" plane, but having otherwise 
identical characteristics as the pinhole. The aperture is presumed to 
have a (virtual) diameter of "aperture" POV-Ray units.

I /think/ that should give you all information required to compute the 
K-matrix parameters - provided you know what the individual K-matrix 
parameters actually mean, which I really absolutely don't.


Post a reply to this message

From: StudentPHD
Subject: Re: camera calibration
Date: 19 Mar 2013 15:35:00
Message: <web.5148bcf56fcdc4138b814ba80@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 13.03.2013 22:43, schrieb StudentPHD:
>
> > My problem is about the matrix K of internal parameters(3 by 3). It means the
> > focal, size of pixel(is square or not?),...
> >
> > And Finally, I need the model used by povray to project the 3D point. I know
> > that I use a perspective type of projetion but . There many manner to calculate
> > the matrix of camera. like P=  k*[R T] , P=K*[R -R*T]. I need to know which
> > model the pov ray software uses ?
>
> The standard camera model used by POV-Ray is a simple pinhole camera,
> with the pinhole being located exactly at the camera's nominal location.
>
> The way you specified the camera (with an explicit angle), the camera is
> presumed to have a distane between the "film" and the "lens" of 1
> POV-Ray unit, and the "film" is supposed to have a size of tan(angle) by
> tan(angle)*|up|/|right| POV-Ray units, divided into image_width by
> image_height pixels.
>
> If using focal blur, the camera is presumed to have a simple lens
> instead of a pinhole, focusing the plane at a distance of
> |focal_point-location| onto the "film" plane, but having otherwise
> identical characteristics as the pinhole. The aperture is presumed to
> have a (virtual) diameter of "aperture" POV-Ray units.
>
> I /think/ that should give you all information required to compute the
> K-matrix parameters - provided you know what the individual K-matrix
> parameters actually mean, which I really absolutely don't.




Hello,

I am developping an 3D reconstruction application. So I am generating some
testing images using pov ray. To achieve the 3D reconstruction, I have to
calculate the matrix projection.
I am developping all necessary functions and I calculate the matrix project p=
K*[R,-R*C] where R is the rotation matrix and C is the camera center and K is
the internal matrix of the camera.
my camera setting is like this:

camera {
                        location<0, 0, 0>
                        rotate<20,-45,0>
                        translate<300, 250, -300>
                        up <0,2,0>
                        right <2,0,0>
                        direction <0, 0, 1>
                        look_at <0,0,1>  }


The focal f=1, (norm[direction]), the angle =90 and the image is rendered as
600*800 pixels, so the matrix K=
(400 0 400.
0 -300  300.
0 0 1 ).


I calculate the rotation matrix like this:

Rx=RotationMatrix[20,{1,0,0}];
Ry=RotationMatrix[-45,{0,1,0}];
Rz=RotationMatrix[0,{0,0,1}];

R=Transpose[Rx,Ry,Rz].

C=[300,250,-300];

To check if my Matrix P is true or not.
1)  I photograph a cube using the camera above. I obtain its image 2D.
Therefore, I extract the coordinates of  3D corner of the cube and the
coordinate of its projection in the image 2D. for example corner 1= (100,0,-180)
its projection is (123,439).
2) I construct the same cube on matlab and I project it on 2D using the
projection matrix p and I get the coordinate 2D of the corners. I obtain the
results:

if I cancel the rotation and the translation (R=matrix identity and C=(0,0,0))
the coordinate of corners are maching very well, so P is correct

If I translate the camera, The corner are matching very well, so P is correct.

If I make a translation and rotation, the corners does not match, so P is not
correct. So where is the error in my code and  is the  camera setting is correct
(I mean that I rotate the camera then I translate it or the inverse, regarding
the calculation of the matrix P=K*[R,-R*C]) ?

Is the calculation of the R is false or what????!! thanks to help me


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.