puzzlepaint / camera_calibration

Accurate geometric camera calibration with generic camera models
BSD 3-Clause "New" or "Revised" License
715 stars 119 forks source link

How to manipulate the grid points for some warping application #14

Open ru040tp6 opened 4 years ago

ru040tp6 commented 4 years ago

Hi @puzzlepaint ,

I want to manipulate the grid points of generic model of camera for some other warping application. I have read the function bool TestCentralGenericCameraReprojection() https://github.com/puzzlepaint/camera_calibration/blob/2682d587e1272b8e2ab845074bdf050cf9248ef0/applications/camera_calibration/generic_models/src/main.cc#L38 However, I still do not well understand the meaning of grid points.

Could you give more explanations or examples , such as

  1. How to generate a camera object CentralGenericCamera, represents ideal camera with specific width(w), height(h), position of projected optical center (cx, cy), and specific focal length (fx, and fy)?
  2. What is the optical meaning of calibration_min_x, calibration_max_x...? Whether image areas out of these parameters cover range are out of calibration?
puzzlepaint commented 4 years ago
  1. The grid points are used with B-Spline interpolation to look up the viewing direction corresponding to a given image pixel (see our paper for an illustration). In order to manually set up the generic camera model to represent some other ideal camera model, there are two options:
    • If the B-Spline interpolation result can represent your ideal camera perfectly, then it should be sufficient to set each grid point to the corresponding viewing direction at the grid point's pixel, as computed from the ideal model.
    • If the ideal camera model cannot be represented perfectly, the procedure above can still be used, but it will only initialize the model approximately. As a refinement step, one can then optimize the grid point values to match the ideal model as closely as possible.
    • These two steps are implemented in: CentralGenericModel::FitToDenseModel(const Image<Vec3d>& dense_model, int subsample_step, int max_iteration_count)
  2. Yes, these parameters simply represent a bounding box for the calibrated image area in pixel coordinates. The calibration is only valid for pixels within this bounding box.