Closed cemunds closed 4 years ago
Hi, Sure, I use the same method as you described to get the model/image 2D correspondences. Then, I use vxl library to estimate the focal length and other parameters. Function:
bool natural(const std::vector< vgl_point_2d<double> >& image_pts,
const std::vector< vgl_point_2d<double> >& ground_pts,
const vgl_point_2d<double>& principal_point,
vpgl_calibration_matrix<double>& K);
https://github.com/vxl/vxl/blob/44d99fd0b4e64006824f73d618e12c187fbcd55f/core/vpgl/algo/vpgl_calibration_matrix_compute.h
bool compute( const std::vector< vgl_point_2d<double> >& image_pts,
const std::vector< vgl_point_3d<double> >& world_pts,
const vpgl_calibration_matrix<double>& K,
vpgl_perspective_camera<double>& camera );
https://github.com/vxl/vxl/blob/e83c827ac150d73654d35d70cb179183a73e3bec/core/vpgl/algo/vpgl_camera_compute.h
Hope that helps.
As far as I understand, I would need to identify images with similar (or even same) focal length, so that I can then estimate the common camera position for all of the images. Is that correct?
If so, how do you identify the images that have a similar focal length? I know there are algorithms in OpenCV and vxl to estimate the camera's intrinsic parameters. However, they usually require multiple views of the calibration pattern with differing position and rotation of the pattern, but the same focal length in every view. So I'm stuck in an endless loop: I need images with similar focal lengths to estimate the camera pose, but I can't estimate the focal lengths of the images without knowing something else about the camera (like the position and rotation).
Maybe I am on the wrong track or missing something essential here. I would be glad if you could help me with this.
No, that is not correct. We do not need to identify images with similar (or even same) focal length. The "common" camera position is not a 3D point. It is a Gaussian distribution centered at a 3D point. If you look at the two functions in vxl, it only requires 4 point correspondences to compute the focal length from a single image. It does not require multiple views. Using these two functions, we can compute camera parameters in each image independently. Then, we can compute the camera location distribution.
I had a closer look at the implementation of the natural
method you mentioned to estimate the focal length. Indeed I was not aware of this approach and it seems there is no similar method to that in OpenCV. I will try doing the calculation with vxl instead and report back. However, it might take some time, because I need to work on something else in the upcoming week. Thank you for your great help.
Unfortunately, the project I was planning to use this research in was put on halt for the time being and I didn't get around to implementing the camera calibration with vxl myself, yet. I hope that I will get the chance to continue my work on this eventually, but I suppose we can close this issue for now. Thank you again for your help.
Hi,
could you give some more insight into the pre-processing you mention in the paper? I tried to reproduce your results for the camera location distribution (mu = [52, -45, 17], sigma = [2, 9, 3]), but I did not obtain the same values.
Currently, I am warping the points of the field model (in worldcup2014.mat) onto the image, using the respective homography matrix of each image. I then try to calibrate the camera with the point correspondences between the model and the image using OpenCV. However, since the images in the dataset have different levels of zoom, the focal length cannot be estimated correctly, and thus most of the other parameters are not correct, either.
Could you explain your approach for the calculation of the camera location distribution?
Thanks