halcon标定之two_camera_calibration.hdev

*本例程展示了标定相机的高精度拼接

  • This example program shows how high precision mosaicking

  • can be performed with calibrated cameras.

  • 更多信息可以在解决方案Guide III-C 3D Vision第9和10张找到

  • Further information can be found in the

  • Solution Guide III-C 3D Vision, Chapters 9 and 10.
    *这个示例在再第9张中,用来展示标定拼接

  • This example program is used in chapter 9 to

  • illustrate calibrated mosaicking.

  • 关闭更新
    dev_update_off ()
    ImgPath := ‘3d_machine_vision/multiple_cameras/’

  • 开启两窗体

  • Open two windows for the left and the right image.
    *先关闭所有窗体
    dev_close_window ()
    *读取图像
    read_image (Image1, ImgPath + ‘camera1_ref’)
    *获取图像尺寸
    get_image_size (Image1, Width, Height)
    *定义窗体缩放尺寸
    WindowScale := 0.66
    *打开两个窗体
    dev_open_window (0, 0, Width * WindowScale, Height * WindowScale, ‘black’, WindowHandle1)
    dev_open_window (0, Width * WindowScale + 6, Width * WindowScale, Height * WindowScale, ‘black’, WindowHandle2)

  • 设置一些窗体参数

  • Set some parameters for both windows.
    *设置窗体1的一些参数,颜色,填充方式,线宽
    dev_set_window (WindowHandle1)
    dev_set_color (‘green’)
    dev_set_draw (‘margin’)
    dev_set_line_width (2)
    dev_set_part (0, 0, Height - 1, Width - 1)
    set_display_font (WindowHandle1, 16, ‘mono’, ‘true’, ‘false’)

  • 设置窗体2的一些参数,颜色,填充方式,线宽
    dev_set_window (WindowHandle2)
    dev_set_color (‘green’)
    dev_set_draw (‘margin’)
    dev_set_line_width (2)
    dev_set_part (0, 0, Height - 1, Width - 1)
    set_display_font (WindowHandle2, 16, ‘mono’, ‘true’, ‘false’)

  • 我们假设两个相机都已经标定好

  • We assume that the two cameras are already calibrated

  • (we know the internal camera parameters).
    *生成两个相机初始参数
    gen_cam_par_area_scan_division (0.01619, -734.789, 7.402e-006, 7.4e-006, 324.911, 256.894, 640, 480, CamParam1)
    gen_cam_par_area_scan_division (0.0162584, -763.35, 7.39842e-006, 7.4e-006, 324.176, 245.371, 640, 480, CamParam2)

  • 读取并显示图像

  • Read the images and display them.
    read_image (Image1, ImgPath + ‘camera1_ref’)
    read_image (Image2, ImgPath + ‘camera2_ref’)
    *分别在连个窗体中显示图像
    dev_set_window (WindowHandle1)
    dev_display (Image1)
    dev_set_window (WindowHandle2)
    dev_display (Image2)

  • 准备相机标定

  • Pre

  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
calibration_curve是一个在机器学习中可用于评估分类模型校准性的函数,它可以帮助我们了解模型的预测概率与实际概率之间的偏差。而c-index是一个用于度量模型预测排序能力的评价指标。在Python中,我们可以使用scikit-learn库中的相关函数和工具进行处理。 首先,我们需要导入scikit-learn库中的calibration_curve和metrics模块: ```python from sklearn.calibration import calibration_curve from sklearn import metrics ``` 接下来,我们可以使用calibration_curve函数来计算校准曲线的数据,同时传入模型的预测概率和真实标签: ```python probs = model.predict_proba(X_test)[:, 1] true_label = y_test fraction_of_positives, mean_predicted_value = calibration_curve(true_label, probs, n_bins=10) ``` 在这个例子中,我们使用X_test作为测试数据集的特征,y_test作为测试数据集的真实标签。model是我们训练好的分类模型。 接着,我们可以使用matplotlib库来绘制校准曲线: ```python import matplotlib.pyplot as plt plt.plot(mean_predicted_value, fraction_of_positives, 's-', label='Calibration curve') plt.plot([0, 1], [0, 1], '--', color='gray', label='Perfectly calibrated') plt.xlabel('Mean predicted value') plt.ylabel('Fraction of positives') plt.legend() plt.title('Calibration curve') plt.show() ``` 最后,我们可以使用metrics模块中的c-index函数来计算c-index: ```python c_index = metrics.roc_auc_score(true_label, probs) ``` 这样,我们就可以通过使用calibration_curve函数来绘制校准曲线,并使用c-index函数来计算模型的c-index值,从而对模型的预测效果进行评估。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值