Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Extrinsic parameters, camera calibration

Dear readers,

 

I would like to know if somene could help me understand a few things regarding the extrinsic parameters of (single) camera calibration.

 

As far as I understand, the function "IMAQ Get Camera Parameters" also returns the projection matrix. By reading the documentation, I saw that the Projection matrix is the product of Camera matrix and Homography matrix.

 

To compare this to the Matlab Calibration Toolbox, how is this related? To rephrase this - I would like to know how to obtain the Rotation matrix and the Translation vector (like in the Matlab example below) in Labview?

 

Untitled.jpg

 

So this equals to the Homography matrix in Labview? In order to obtain this in Labview I have to calculate this from the Projection matrix and the Camera matrix? What is the skew angle of y with respect to x in this case (Camera matrix)? Is it 0?


To summarize:

 

I would like to obtain the Rotation matrix and Translation matrix to to move the camera coordinate system to world coordinate system in Labview.

 

Please help me understand.

 

Best regards,

K


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
0 Kudos
Message 1 of 18
(9,578 Views)

Hi Klemen,

 

I can only recommend to every new user of any NI Vision function to go throught NI Vision Concepts Help, which describes the theory behind Vision funcftions (It is also available on your HDD in following dirctory - c:\Program Files (x86)\National Instruments\Vision\Documentation\NIVisionConcepts.chm). You would be interested into Spatial Calibration / In-Depth Discussion chapter which is describing how the calibration works.

 

okubik

CLA, CTA, CLED
0 Kudos
Message 2 of 18
(9,556 Views)

Thank you for your answer,

 

though it did not help me much. I have read the NI Vision Concepts Manual (and some other papers in prior) regarding this and I do understand the concepts of intrinsic and extrinsic calibration, but was not familiar how the Labview Camera calibration outputs the values. After some consideration, I think I understand now.

 

Please correct me if I am wrong with the following.

 

The projection matrix also known as the homography matrix (W) is written as (with generalization that the target is planar): W = [r1 r2 t], where r1 and r2 are rotation vectors and t is the translation vector. This is the output of the function "IMAQ Get Camera Parameters". So in order to calculate the third rotation vector r3 , cross product of rotation vectors r1 and r2 must be applied (r3 = r1 x r2), thus obtaining the rotation matrix R = [r1 r2 r3] and the translation vector t.

 

Is this correct?

 

Best regards,

K

 

 

 

 

 


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
0 Kudos
Message 3 of 18
(9,547 Views)

Hello Klemen,

 

NI Vision provides a way to convert pixel world to real world.I would like to understand the use case of converting camera coordinate to world coordinate system. How did you arrive at camera coordinates?

 

There is a way to compute Rotation and Translation matrix using Projection Matrix and Camera MAtrix. The relationship is given in concept manual as "okubik" pointed out. Please look at the section "Determining Pose of the object". Projection Matrix = Camera Matrix * [r1, r2 t]; r3 = r1 x r2; It is little complicated to calculate and one might need to know the maths behind it.

Message 4 of 18
(9,544 Views)

Thank you for your prompt answer.

 

What bothers me from the start is this:

 

By looking at the help for "IMAQ Get Camera Parameters" and the explanation about the Projection Matrix, which is according to the documentation, also known as Homograpgy matrix.

 

Similarly looking at the NI Vision concepts manual it is stated that the Homography matrix (W) equals: W = [R t], where R is the Rotation matrix and t is the Translation vector.

 

Could you please explain this?

 

Thank you and best regards,

K


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
0 Kudos
Message 5 of 18
(9,540 Views)

I would just like to know what is the output of the VI "IMAQ Get Camera Parameters" -  is the the projection matrix really the homography matrix or what?

 

The Vision Concepts says:

 

In NI Vision calibration software, homography (H) is a 3 × 3 matrix which is the product of two matrices: a camera matrix (M) and a homography matrix (W).

 

So H = MW. We have two of these matrices defined - M is the camera matrix for sure, but which one is the projection matrix (the output of "IMAQ Get Camera Parameters")? The calculation of the third unknown matrix is then trivial.

 

It bothers me that the documentation is so ambiguous! Guess I' ll use Matlab for the calibration. But I would still like to know what is the deal with this? Anyone please?

 

Best regards

K


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
0 Kudos
Message 6 of 18
(9,516 Views)

Hello Klemen,

 

The projection matrix is H (Homography) and this is what you get out of IMAQ Get Camera Parameters. You can construct camera matrix (M) out of Focal Length and Optical center. Matrix W = [R T] can be computed by using M and H.

 

Thanks for your honest opinion about documentation, I will pass on the recommendation.

 

NI Vision has easy way of  calibrating the and computing camera model using Calibration Training Interface and most of the machine vision algorithms has inbuilt mechanism to use the calibration and meaure in real world units. I have not used Matlab, so can not comment on that.

 

Again, I would like to understand your use case about converting camera coordinate to world coordinate system. Why do you need to work with camera coordinates instead of pixel coordinates?

Message 7 of 18
(9,510 Views)

Dear invancea,

 

I am very grateful for your explanation regarding this. If this is so, I will indeed try this with Labview.

 

I am going to build a simple laser scanner (webcam, cheap laser, old printer linear drive, etc). Will post this to the blog with more detailed explanation (https://decibel.ni.com/content/blogs/kl3m3n) once I finish this.

 

But basically I will detect the laser line, correct the coordinates in image space (principal point, focal dist., distortion) and then transform these image coordinates to the 3D camera coordinate system using a pinhole camera model. Then I want to try to transfrom the points from the camera coordinate system to a world coordinate system. That is why I need to know the relation between the camera coordinate system and the calibration plane.

 

Best regards,

K


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
0 Kudos
Message 8 of 18
(9,498 Views)

Dear ivancea,

 

I also would like to thank you for this explanation. The in-depth documentation in the vision concepts (over here) confused me as well, for two reasons:

 

1. Nomenclature. After reading about the camera matrix on wikipedia, here, I had a completely different understanding of the camera matrix. If I'm not mistaken, the camera matrix C  on Wikipedia corresponds to the Labview projection matrix / homography H? Also, I conclude that there is a difference between homography H (which is a matrix) and the homography matrix W, am I right? This is confusing again, since in the Labview Help for IMAQ get camera parameters it is stated that 

Projection Matrix indicates the projection matrix, also known as the homography matrix, of the working plane. Refer to the NI Vision Concepts Help for more information about the homography matrix. So here the homography matrix is the same as the projection matrix (which is homography, which is not the homography matrix)... 

 

2. Matrix dimensions. According to the in depth documentation, In NI Vision calibration software, homography (H) is a 3 × 3 matrix which is the product of two matrices: a camera matrix (M) and a homography matrix (W). Since (also according to the documentation) p = sHP where p is 3x1, s is a scalar, P is 4x1, we know that H should have dimensions 3x4 and not 3x3. Am I correct that this is a mistake in the NI Vision Concepts?

 

Thanks for replying, Jacob

Message 9 of 18
(8,629 Views)

Hello, I agreed jacobb93 : the documentation isn't clear enough and the link between the theorytical background and the VI is difficult to understand. Smiley Indifferent

 

For instance, when I use the VI IMAQ Get Camera Parameters, I don't understand the "projection matrix".

This matrix is a 3x3 matrix, I supposed it was the homography matrix named W = [R t] = [r1 r2 t] in the documentation (we can easily calculate the M-matrix with the internal coefficients).  

This isn't correct : the vectors r1 and r2 haven't the same norm...

 

The I imagine the Projection matrix correspond with M*W matrix. So I calculate M^-1 * M * W   to know W = [R t] = r1 r2 t]  but I have the same problem of norm....

 

I don't known what I misunderstand in this problem... Can someone help me to understand the VI IMAQ Get Camera Parameters ?

 

PS : sorry for my poor english

0 Kudos
Message 10 of 18
(7,089 Views)