相机投影仪校准

时间:2019-05-11 09:10:09

标签: opencv camera-calibration

考虑相机投影仪校准时,我有一个问题。我了解逻辑,并且已经成功应用了它。 最后,我得到了照相机和投影仪的一对内在函数,外部参数,以及照相机和投影仪之间的R和T。

要将显示在相机中选择的点显示到投影仪,我目前正在将该2d点转换为3d点,并且由于相机和投影仪具有共同的坐标系,因此我将该3d点转换为投影仪坐标。

这在校准相机和投影仪的深度上效果很好,但是对于不同的深度我不起作用。我该怎么办?

示例:

    Camera Points: 
    779.627625 580.277161
    780.342590 530.316711
    781.360291 480.577271

    Projector Points:
    215.187103 421.870483
    214.948257 367.660767
    214.871384 313.792572

    World Points:
    0.000000 0.000000 0.000000
    3.000000 0.000000 0.000000
    6.000000 0.000000 0.000000



    //calibrate the camera ////////////////////////////////////
    std::vector<cv::Mat> cam_rvecs, cam_tvecs;
    calib.cam_error = cv::calibrateCamera(world_corners_active,camera_corners_active, imageSize, calib.cam_K, calib.cam_kc, cam_rvecs,am_tvecs, 0 + cv::CALIB_FIX_K3;,cv::TermCriteria(cv::TermCriteria::COUNT + cv::TermCriteria::EPS, 50, DBL_EPSILON));

    //calibrate the Projector ////////////////////////////////////
    std::vector<cv::Mat> cam_rvecs, cam_tvecs;
    calib.cam_error = cv::calibrateCamera(world_corners_active,camera_corners_active, imageSize, calib.cam_K, calib.cam_kc, cam_rvecs,am_tvecs, 0 + cv::CALIB_FIX_K3;,cv::TermCriteria(cv::TermCriteria::COUNT + cv::TermCriteria::EPS, 50, DBL_EPSILON));

    //stereo calibration ////////////////////////////////////

    calib.stereo_error = cv::stereoCalibrate(world_corners_active, camera_corners_active, projector_corners_active, calib.cam_K, calib.cam_kc, calib.proj_K, calib.proj_kc, imageSize , calib.R, calib.T, E, F,cv::TermCriteria(cv::TermCriteria::COUNT + cv::TermCriteria::EPS, 150,DBL_EPSILON), cv::CALIB_FIX_INTRINSIC + cal_flags);

0 个答案:

没有答案