前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >halcon标定后畸变校正与测量

halcon标定后畸变校正与测量

作者头像
vv彭
发布2020-10-30 10:29:10
1.8K0
发布2020-10-30 10:29:10
举报

这是一个很久以前的微博网友写的,现在的halcon运行有问题,因为已经没有parameters_image_to_world_plane_centered这个函数了,知道现在版本替换它的函数的朋友麻烦告知一下,万分感谢

本文出处:http://blog.sina.com.cn/s/blog_442bfe0e0100yjce.html#commonComment

1.get_image_size(Image : : : Width, Height)

返回图像的尺寸。

2.parameters_image_to_world_plane_centered (CamParam, Pose, CenterRow, CenterCol, WidthMappedImage, HeightMappedImage, ScaleForCenteredImage, PoseForCenteredImage)

Halcon内部程序,输出为图像的比率和姿态。

3.gen_image_to_world_plane_map( : Map : CameraParam, WorldPose, WidthIn, HeightIn, WidthMapped, HeightMapped, Scale, MapType : )

产生一个投影映射,该映射描述图像平面与Z=O的世界平面之间的关系,输出为图像MAP,是一个多通道的图像

包含了映射数据。

4.map_image(Image, Map : ImageMapped : : )

利用映射变换校正图像,输出为矫正后的图像。

5.image_to_world_plane(Image : ImageWorld : CameraParam, WorldPose, Width, Height, Scale, Interpolation : )

把校正后的图像转换到Z=0的世界平面。

6.image_points_to_world_plane( : : CameraParam, WorldPose, Rows, Cols, Scale : X, Y)

把图像上的点转换到Z=0的世界平面,输出为点坐标。

* This program provides procedures for the determination of the * parameters Pose and Scale of the operators image_to_world_plane * and gen_image_to_world_plane_map. * * Read the image ImgPath := '3d_machine_vision/calib/' read_image (Image, ImgPath+'caliper_01') * Set the camera parameters for the image CamParam := [0.0160728,-631.843,7.40077e-006,7.4e-006,326.369,246.785,652,494] Pose := [-41.2272,26.763,398.682,359.655,359.202,322.648,0] * Reopen the window appropriately get_image_size (Image, WidthOriginalImage, HeightOriginalImage) dev_open_window_fit_image (Image, 0, 0, WidthOriginalImage, HeightOriginalImage, WindowHandle) set_display_font (WindowHandle, 14, 'mono', 'true', 'false') dev_set_color ('red') WidthMappedImage := 652 HeightMappedImage := 494 * Transform the image such that a given point appears in the * center of the rectified image and the the scale of the rectified image * is similar to the scale of the original image (in the surroundings * of the given point) * Define the point that will appear in the center of the rectified image dev_display (Image) disp_message (WindowHandle, 'Define the center of the mapped image', 'window', 12, 12, 'white', 'false') get_mbutton (WindowHandle, CenterRow, CenterCol, Button) * Determine scale and pose such that the given point appears * in the center of the rectified image and that the * scale of the two images is similar (in the surroundings * of the given point). parameters_image_to_world_plane_centered (CamParam, Pose, CenterRow, CenterCol, WidthMappedImage, HeightMappedImage, ScaleForCenteredImage, PoseForCenteredImage) * Rectify the image gen_image_to_world_plane_map (Map, CamParam, PoseForCenteredImage, WidthOriginalImage, HeightOriginalImage, WidthMappedImage, HeightMappedImage, ScaleForCenteredImage, 'bilinear') map_image (Image, Map, ImageMapped) dev_open_window_fit_image (ImageMapped, 0, 0, WidthMappedImage, HeightMappedImage, WindowHandleMapped) set_display_font (WindowHandleMapped, 14, 'mono', 'true', 'false') dev_set_color ('red') dev_display (ImageMapped) * In case, only one image has to be mapped, the operator * image_to_world_plane can be used instead of the operators * gen_image_to_world_plane_map together with map_image. image_to_world_plane (Image, ImageMapped, CamParam, PoseForCenteredImage, WidthMappedImage, HeightMappedImage, ScaleForCenteredImage, 'bilinear') * Display the center point image_points_to_world_plane (CamParam, PoseForCenteredImage, CenterRow, CenterCol, ScaleForCenteredImage, CenterX, CenterY) disp_cross (WindowHandleMapped, CenterY, CenterX, 6, rad(45)) disp_message (WindowHandleMapped, 'The selected point appears in the center', 'window', 12, 12, 'white', 'false') disp_message (WindowHandleMapped, 'of the rectified image', 'window', 36, 12, 'white', 'false') disp_continue_message (WindowHandleMapped, 'black', 'true') stop () * * Now determine scale and pose such that the entire image * fits into the rectified image. parameters_image_to_world_plane_entire (Image, CamParam, Pose, WidthMappedImage, HeightMappedImage, ScaleForEntireImage, PoseForEntireImage) * Rectify the image image_to_world_plane (Image, ImageMapped, CamParam, PoseForEntireImage, WidthMappedImage, HeightMappedImage, ScaleForEntireImage, 'bilinear') dev_clear_window () dev_display (ImageMapped) disp_message (WindowHandleMapped, 'The entire image is visible in the rectified image', 'window', -1, -1, 'white', 'false')

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2020-10-22 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档