跳转到内容
View in the app

A better way to browse. Learn more.

彼岸论坛

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[OpenCV] 请问一个关于 OpenCV 手眼标定(cv::calibrateHandEye)获取相机安装参数的问题

发表于

我有一台固定在云台上的相机,我想要知道这个相机相对安装平台的旋转和平移量。其中云台是固定不动的,只有 pitch 、yaw 、和 roll 轴的运动。查了一下应该是用这个函数:

void calibrateHandEye(
    InputArrayOfArrays R_gripper2base,  // 云台 p y r 角度转换出来的旋转矩阵
    InputArrayOfArrays t_gripper2base,  // 输入的是 0 ,因为没有任何移动(并且想用云台平台当世界坐标中心点)
    InputArrayOfArrays R_target2cam,    // calibrateCamera 输出的 rvec
    InputArrayOfArrays t_target2cam,    // calibrateCamera 输出的 tvec
    OutputArray R_cam2gripper, 
    OutputArray t_cam2gripper, 
    HandEyeCalibrationMethod method = CALIB_HAND_EYE_TSAI)

我现在是这样做的:

  1. 将云台的 p y r 旋转到不同角度,拍摄棋盘格的照片,同时记录该时刻的 p y r 角旋转角度;
  2. 使用 calibrateCamera 得到每一张图片里棋盘格的 tvec 和 rvec ;
  3. 将记录的云台 p y r 角度转换为旋转矩阵;
  4. 调用 calibrateHandEye 。

但是结果和实际相差巨大。因此想来 V 站看看有没有人有过这方面经验,能看出我的步骤里可能有什么问题……先在这里谢过各位了!


我个人感觉比较容易出问题的地方是第三步的转换,我是这样写的:

    Eigen::Quaternionf euler2quaternionf(const float z, const float y, const float x)
    {
        const float cos_z = cos(z * 0.5f), sin_z = sin(z * 0.5f),
                    cos_y = cos(y * 0.5f), sin_y = sin(y * 0.5f),
                    cos_x = cos(x * 0.5f), sin_x = sin(x * 0.5f);

        Eigen::Quaternionf quaternion(
            cos_z * cos_y * cos_x + sin_z * sin_y * sin_x,
            cos_z * cos_y * sin_x - sin_z * sin_y * cos_x,
            sin_z * cos_y * sin_x + cos_z * sin_y * cos_x,
            sin_z * cos_y * cos_x - cos_z * sin_y * sin_x
        );

        return quaternion;
    }

先转换为四元数,再求旋转矩阵(用 Eigen 自带的方法)。

Featured Replies

No posts to show

创建帐户或登录来提出意见

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.