OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Tue, 12 Feb 2013 04:54:31 -0600Camera with auto-focus and 3D reconstructionhttp://answers.opencv.org/question/7278/camera-with-auto-focus-and-3d-reconstruction/Hi,
I'm using some very simple web cam, during the chessboard calibration I got every time very **different intrinsic matrix**(especially the part with focal lengths), is it because the camera has auto-focus? If I take the pictures of multiple chessboard position the undistorted image is afterward **more distorted then the original**, how can it be? Is it possible the auto-focus is disturb somehow the distortion parameters calculation? When I want to calculate projection matrix I need **non-variable focus length**, needn't I?
But I don't understand how such a camera can have auto-focus, when the there is need to screw the lens to make the picture sharp? I thought auto-focus is moving some lens to focus??
And second question is if I want to make a laser scanner. I need to somehow calculate the homography to laser plane is it right? So probably I can directly find the laser line on the chessboard during the calibration. But do I need to measure the distance of the chessboard or can I somehow calculate the distance from the chessboard? **Do I need chessboard 3D coordinates to calculate the extrinsic matrix**?
Thanks for your time
Regards
Martin
Tue, 12 Feb 2013 02:02:17 -0600http://answers.opencv.org/question/7278/camera-with-auto-focus-and-3d-reconstruction/Answer by Mathieu Barnachon for <p>Hi,
I'm using some very simple web cam, during the chessboard calibration I got every time very <strong>different intrinsic matrix</strong>(especially the part with focal lengths), is it because the camera has auto-focus? If I take the pictures of multiple chessboard position the undistorted image is afterward <strong>more distorted then the original</strong>, how can it be? Is it possible the auto-focus is disturb somehow the distortion parameters calculation? When I want to calculate projection matrix I need <strong>non-variable focus length</strong>, needn't I?</p>
<p>But I don't understand how such a camera can have auto-focus, when the there is need to screw the lens to make the picture sharp? I thought auto-focus is moving some lens to focus??</p>
<p>And second question is if I want to make a laser scanner. I need to somehow calculate the homography to laser plane is it right? So probably I can directly find the laser line on the chessboard during the calibration. But do I need to measure the distance of the chessboard or can I somehow calculate the distance from the chessboard? <strong>Do I need chessboard 3D coordinates to calculate the extrinsic matrix</strong>?</p>
<p>Thanks for your time</p>
<p>Regards </p>
<p>Martin</p>
http://answers.opencv.org/question/7278/camera-with-auto-focus-and-3d-reconstruction/?answer=7281#post-id-7281To determine intrinsic parameters, you need to capture many images of the same chessboard, in different positions. If the auto focus seems to be a problem, try to put your chessboard always in the same distance from the camera.
To evaluate the extrinsic parameters, you need the 3D coordinates of chessboard. Usually, without any other transformations, the 3D points used are (0,0,0) for the first corner of the chessboard, and ``logical'' position for the others, ie: (1,0,0) if you use a logical basis, or (2.5,0,0) if you have corners of size 2.5cm for a metric basis, etc.
For the laser line, you can evaluate the coordinates of the line with the extrinsic parameters, with the chessboard, but what is your purpose? If you move the camera, the 3D coordinate (extrinsic parameters) will changed. Could you please describe your setup with the laser? Where the objects will be, is the camera moving, is the laser line moving?Tue, 12 Feb 2013 02:27:33 -0600http://answers.opencv.org/question/7278/camera-with-auto-focus-and-3d-reconstruction/?answer=7281#post-id-7281Comment by Martin for <p>To determine intrinsic parameters, you need to capture many images of the same chessboard, in different positions. If the auto focus seems to be a problem, try to put your chessboard always in the same distance from the camera.</p>
<p>To evaluate the extrinsic parameters, you need the 3D coordinates of chessboard. Usually, without any other transformations, the 3D points used are (0,0,0) for the first corner of the chessboard, and ``logical'' position for the others, ie: (1,0,0) if you use a logical basis, or (2.5,0,0) if you have corners of size 2.5cm for a metric basis, etc.</p>
<p>For the laser line, you can evaluate the coordinates of the line with the extrinsic parameters, with the chessboard, but what is your purpose? If you move the camera, the 3D coordinate (extrinsic parameters) will changed. Could you please describe your setup with the laser? Where the objects will be, is the camera moving, is the laser line moving?</p>
http://answers.opencv.org/question/7278/camera-with-auto-focus-and-3d-reconstruction/?comment=7290#post-id-7290If you know where the laser plane is in space you can do this, every laser line the camera will see must be part of the laser plane. So if you know how to describe the laser plane, means you know how the points are transformed from the laser plane to the sensor plane, you can do that in reverse an for a point in 2D you will find point on the 2D laser plane and from this you can calculate the 3D coordinates. Nice theory isn't it:) Tue, 12 Feb 2013 04:01:50 -0600http://answers.opencv.org/question/7278/camera-with-auto-focus-and-3d-reconstruction/?comment=7290#post-id-7290Comment by Martin for <p>To determine intrinsic parameters, you need to capture many images of the same chessboard, in different positions. If the auto focus seems to be a problem, try to put your chessboard always in the same distance from the camera.</p>
<p>To evaluate the extrinsic parameters, you need the 3D coordinates of chessboard. Usually, without any other transformations, the 3D points used are (0,0,0) for the first corner of the chessboard, and ``logical'' position for the others, ie: (1,0,0) if you use a logical basis, or (2.5,0,0) if you have corners of size 2.5cm for a metric basis, etc.</p>
<p>For the laser line, you can evaluate the coordinates of the line with the extrinsic parameters, with the chessboard, but what is your purpose? If you move the camera, the 3D coordinate (extrinsic parameters) will changed. Could you please describe your setup with the laser? Where the objects will be, is the camera moving, is the laser line moving?</p>
http://answers.opencv.org/question/7278/camera-with-auto-focus-and-3d-reconstruction/?comment=7293#post-id-7293I thought I can some how use the chessboard to do this. If I find the corners then I must know where the chessboard is. The laser is bound with the camera 10cm next to the objective let's say form 85 degrees angle. I hope I can find the line on the chessboard, from it I can extract 2 point and next 2 points from chessboard in different position, then I hope I can use this points(that describes the laser plane) to call opencv findHomography matrix and then I have the whole chain.
So the chain is Intrinsic * Distortion * Projection * Homography. I think the extrisic matrix means(Projection*Homography). I seams it is common principle, common but not enough simple for me to understand;)Tue, 12 Feb 2013 04:17:09 -0600http://answers.opencv.org/question/7278/camera-with-auto-focus-and-3d-reconstruction/?comment=7293#post-id-7293Comment by Mathieu Barnachon for <p>To determine intrinsic parameters, you need to capture many images of the same chessboard, in different positions. If the auto focus seems to be a problem, try to put your chessboard always in the same distance from the camera.</p>
<p>To evaluate the extrinsic parameters, you need the 3D coordinates of chessboard. Usually, without any other transformations, the 3D points used are (0,0,0) for the first corner of the chessboard, and ``logical'' position for the others, ie: (1,0,0) if you use a logical basis, or (2.5,0,0) if you have corners of size 2.5cm for a metric basis, etc.</p>
<p>For the laser line, you can evaluate the coordinates of the line with the extrinsic parameters, with the chessboard, but what is your purpose? If you move the camera, the 3D coordinate (extrinsic parameters) will changed. Could you please describe your setup with the laser? Where the objects will be, is the camera moving, is the laser line moving?</p>
http://answers.opencv.org/question/7278/camera-with-auto-focus-and-3d-reconstruction/?comment=7288#post-id-7288The intrinsic parameters should be the same for all identical camera.
But this is only the theory... in practice, it depends on the quality of your camera, specially, it could have some difference with two identical low cost webcam.
For the laser part, I don't understand what you want to do.
You cannot directly find 3D position with one camera and a line.
You have to use stereo-vision or SLAM-based approach with one camera (ie a moving camera).Tue, 12 Feb 2013 03:02:58 -0600http://answers.opencv.org/question/7278/camera-with-auto-focus-and-3d-reconstruction/?comment=7288#post-id-7288Comment by Mathieu Barnachon for <p>To determine intrinsic parameters, you need to capture many images of the same chessboard, in different positions. If the auto focus seems to be a problem, try to put your chessboard always in the same distance from the camera.</p>
<p>To evaluate the extrinsic parameters, you need the 3D coordinates of chessboard. Usually, without any other transformations, the 3D points used are (0,0,0) for the first corner of the chessboard, and ``logical'' position for the others, ie: (1,0,0) if you use a logical basis, or (2.5,0,0) if you have corners of size 2.5cm for a metric basis, etc.</p>
<p>For the laser line, you can evaluate the coordinates of the line with the extrinsic parameters, with the chessboard, but what is your purpose? If you move the camera, the 3D coordinate (extrinsic parameters) will changed. Could you please describe your setup with the laser? Where the objects will be, is the camera moving, is the laser line moving?</p>
http://answers.opencv.org/question/7278/camera-with-auto-focus-and-3d-reconstruction/?comment=7291#post-id-7291I'm sorry, maybe I'm not awake this morning, but how do you know where the laser plane is?Tue, 12 Feb 2013 04:04:53 -0600http://answers.opencv.org/question/7278/camera-with-auto-focus-and-3d-reconstruction/?comment=7291#post-id-7291Comment by Martin for <p>To determine intrinsic parameters, you need to capture many images of the same chessboard, in different positions. If the auto focus seems to be a problem, try to put your chessboard always in the same distance from the camera.</p>
<p>To evaluate the extrinsic parameters, you need the 3D coordinates of chessboard. Usually, without any other transformations, the 3D points used are (0,0,0) for the first corner of the chessboard, and ``logical'' position for the others, ie: (1,0,0) if you use a logical basis, or (2.5,0,0) if you have corners of size 2.5cm for a metric basis, etc.</p>
<p>For the laser line, you can evaluate the coordinates of the line with the extrinsic parameters, with the chessboard, but what is your purpose? If you move the camera, the 3D coordinate (extrinsic parameters) will changed. Could you please describe your setup with the laser? Where the objects will be, is the camera moving, is the laser line moving?</p>
http://answers.opencv.org/question/7278/camera-with-auto-focus-and-3d-reconstruction/?comment=7287#post-id-7287Thanks for quick answer.
I thought it is important the chessboard position will vary. I understand you want to neglect the influence of auto-focus, will try anyway. Is it correct the intrinsic matrix should be always nearly the same for the same camera setup?
It will be line laser shining on the scene, this line creates the laser plane, so my idea that there will be some matrix chain that will give me for specific 2D point of laser line in picture it's 3D coordinate on the laser plane. Just now I only want to convert the laser line to 3D point. I need to confess I'm little bit lost in here:(
I wanted to start with moving object, but afterward the camera with the beam will move. I hope for both case it is just some additional rotation with different center.
Tue, 12 Feb 2013 02:56:11 -0600http://answers.opencv.org/question/7278/camera-with-auto-focus-and-3d-reconstruction/?comment=7287#post-id-7287Comment by Martin for <p>To determine intrinsic parameters, you need to capture many images of the same chessboard, in different positions. If the auto focus seems to be a problem, try to put your chessboard always in the same distance from the camera.</p>
<p>To evaluate the extrinsic parameters, you need the 3D coordinates of chessboard. Usually, without any other transformations, the 3D points used are (0,0,0) for the first corner of the chessboard, and ``logical'' position for the others, ie: (1,0,0) if you use a logical basis, or (2.5,0,0) if you have corners of size 2.5cm for a metric basis, etc.</p>
<p>For the laser line, you can evaluate the coordinates of the line with the extrinsic parameters, with the chessboard, but what is your purpose? If you move the camera, the 3D coordinate (extrinsic parameters) will changed. Could you please describe your setup with the laser? Where the objects will be, is the camera moving, is the laser line moving?</p>
http://answers.opencv.org/question/7278/camera-with-auto-focus-and-3d-reconstruction/?comment=7295#post-id-7295Merci beaucoup!Tue, 12 Feb 2013 04:54:31 -0600http://answers.opencv.org/question/7278/camera-with-auto-focus-and-3d-reconstruction/?comment=7295#post-id-7295Comment by Mathieu Barnachon for <p>To determine intrinsic parameters, you need to capture many images of the same chessboard, in different positions. If the auto focus seems to be a problem, try to put your chessboard always in the same distance from the camera.</p>
<p>To evaluate the extrinsic parameters, you need the 3D coordinates of chessboard. Usually, without any other transformations, the 3D points used are (0,0,0) for the first corner of the chessboard, and ``logical'' position for the others, ie: (1,0,0) if you use a logical basis, or (2.5,0,0) if you have corners of size 2.5cm for a metric basis, etc.</p>
<p>For the laser line, you can evaluate the coordinates of the line with the extrinsic parameters, with the chessboard, but what is your purpose? If you move the camera, the 3D coordinate (extrinsic parameters) will changed. Could you please describe your setup with the laser? Where the objects will be, is the camera moving, is the laser line moving?</p>
http://answers.opencv.org/question/7278/camera-with-auto-focus-and-3d-reconstruction/?comment=7294#post-id-7294You're right! If you find two corners on the chessboard and the position of the laser, you have 3 pts, therefore, you could find the plane made by the laser projection.
It will be a little more complex to find surface of object after, but you could do the first stage!
Enjoy;-)Tue, 12 Feb 2013 04:21:39 -0600http://answers.opencv.org/question/7278/camera-with-auto-focus-and-3d-reconstruction/?comment=7294#post-id-7294