dimanche 21 juin 2020

How does the constructors for cv::Point3f work?

How do these codes work?

  1. cv::Point3f pt{1};
  2. cv::Point3f pt{3};
  3. cv::Point3f pt{1, 2, 3};
  4. std::vector<cv::Point3f> pts{1};
  5. std::vector<cv::Point3f> pts{3};
  6. std::vector<std::vector<cv::Point3f>> object_points{0};
  7. std::vector<std::vector<cv::Point3f>> object_points{1};

These questions arise from my implementation of camera calibration. The camera calibration requires us to create the 2D image_points and the 3D object_points to be used in cv::calibrateCamera() for computing the reprojection error.

Hence, I create the object_points like this:

std::vector<std::vector<cv::Point3f>> object_points{1}; 

... // Fill in the object_points container with the "actual" corners in the chessboard. 

object_points.resize(image_points.size(), object_points[0]); // Copy the entries in object_points[0]` to fill in the outer container of `object_points

Aucun commentaire:

Enregistrer un commentaire