如何利用Halcon写入xls

*打开文件句柄,创建.xls文件
open_file (’…/data1.xls’, ‘output’, FileHand)
open_file (’…/data1.xls’, ‘append’, FileHand)
*第一行第一列写入a,并换列
fwrite_string (FileHand, ‘a\t’)
*第一行第二列写入1,并换行
fwrite_string (FileHand, ‘1\n’)
*第二行第一列写入b,并换列
fwrite_string (FileHand, ‘b\t’)
*第二行第二列写入2,并换行
fwrite_string (FileHand, ‘2\n’)
fwrite_string (FileHand, ‘c\t’)
fwrite_string (FileHand, ‘3\n’)
*清除句柄
close_file (FileHand)
结果图:
结果图

  • 3
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
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函数获取相机参数,并输出到控制台。 需要注意的是,在实际应用中,需要使用多组标定图片进行标定,并对标定结果进行评估和优化,才能获得更精确的相机参数。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值