POV-Ray : Newsgroups : povray.pov4.discussion.general : camera calibration : Re: camera calibration Server Time19 Sep 2024 00:49:18 EDT (-0400)
 Re: camera calibration
 From: StudentPHD Date: 19 Mar 2013 15:35:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.5148bcf56fcdc4138b814ba80%40news.povray.org",
"dateCreated": "2013-03-19T19:35:00+00:00",
"datePublished": "2013-03-19T19:35:00+00:00",
"author": {
"@type": "Person",
"name": "StudentPHD"
}
}
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
```