halcon中9点标定

  • Image Acquisition 01: Code generated by Image Acquisition 01
    open_framegrabber (‘GigEVision2’, 0, 0, 0, 0, 0, 0, ‘progressive’, 8, ‘gray’, -1, ‘false’, ‘default’, ‘00214900eda0_DahengImavision_MER50014GM’, 0, -1, AcqHandle)
    grab_image_start (AcqHandle, -1)
    a:=1
    y:=[2,2,2,4,4,4,6,6,6]
    x:=[6,4,2,6,4,2,6,4,2]
    while (a)
    grab_image_async (Image, AcqHandle, -1)

    • Image Acquisition 01: Do something
      mirror_image (Image, ImageMirror, ‘row’)
      mirror_image (ImageMirror, ImageMirror1, ‘column’)
      rgb1_to_gray (ImageMirror1, GrayImage)
      threshold (GrayImage, Regions1, 13, 31)
      connection (Regions1, ConnectedRegions)
      select_shape (ConnectedRegions, SelectedRegions, ‘area’, ‘and’, 57708.9, 76296.8)
      sort_region (SelectedRegions, SortedRegions, ‘first_point’, ‘true’, ‘row’)
      area_center (SelectedRegions, Area, Row, Column)
      vector_to_hom_mat2d (Row, Column, x, y, HomMat2D)
  • 1
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Halcon的9标定是一种常用的机器视觉标定方法,它可以用于相机的内部和外部参数标定。以下是一个简单的示例代码,演示如何使用Halcon进行9标定: ```csharp // 读取标定图片 HImage image = new HImage("calib_image.jpg"); HTuple width, height; HOperatorSet.GetImageSize(image, out width, out height); // 定义标定坐标 HTuple row = new HTuple(); HTuple col = new HTuple(); row = row.TupleConcat(0.3 * height, 0.3 * height, 0.3 * height, 0.7 * height, 0.7 * height, 0.7 * height, 0.5 * height, 0.5 * height, 0.5 * height); col = col.TupleConcat(0.3 * width, 0.5 * width, 0.7 * width, 0.3 * width, 0.5 * width, 0.7 * width, 0.3 * width, 0.5 * width, 0.7 * width); // 进行标定 HTuple cameraParam = new HTuple(); HTuple worldPose = new HTuple(); HOperatorSet.VectorToPose9(row, col, 0, 0, out worldPose); HOperatorSet.FindCalibObject(image, 9, 0, 0.03, "points", out cameraParam); HOperatorSet.CalibrateCameras(image, cameraParam, worldPose, out cameraParam); // 输出相机参数 HTuple fx, fy, cx, cy, kappa, s; HOperatorSet.TupleSelect(cameraParam, 0, out fx); HOperatorSet.TupleSelect(cameraParam, 1, out fy); HOperatorSet.TupleSelect(cameraParam, 2, out cx); HOperatorSet.TupleSelect(cameraParam, 3, out cy); HOperatorSet.TupleSelect(cameraParam, 4, out kappa); HOperatorSet.TupleSelect(cameraParam, 5, out s); Console.WriteLine("fx={0}, fy={1}, cx={2}, cy={3}, kappa={4}, s={5}", fx, fy, cx, cy, kappa, s); ``` 在这个示例,首先读取标定图片,然后定义标定的坐标。接着,使用Halcon的FindCalibObject函数找到标定,并使用CalibrateCameras函数进行标定。最后,通过TupleSelect函数获取相机参数,并输出到控制台。 需要注意的是,在实际应用,需要使用多组标定图片进行标定,并对标定结果进行评估和优化,才能获得更精确的相机参数。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值