Halcon 例程-----grid_rectidication

该例程讲述了如何通过网格图来矫正一个曲面

* This example illustrates how to use the operators for the grid-rectification.

* The following command creates a postscript file
* that contains the rectification grid. This grid must be
* printed. Then it must be mounted on the object surface.
WidthOfGrid := 0.17
NumSquares := 17

// 创建一个矫正网络
create_rectification_grid (WidthOfGrid, NumSquares, 'rectification_grid.ps')

* Read the image of the object wrapped by the rectification grid
* and reopen the window with an appropriate size.
read_image (Image, 'can_with_grid')
get_image_size (Image, ImageWidth, ImageHeight)
dev_close_window ()
dev_open_window (0, 0, ImageWidth * 0.75, ImageHeight * 0.75, 'black', WindowID1)
dev_display (Image)
dev_update_off ()
set_display_font (WindowID1, 14, 'mono', 'true', 'false')


* Part 1: Determination of the image map
* The surface to be rectified is wrapped by a checkered pattern, which
* is used to determine the mapping between the distorted image and
* the rectified image. Note the orientation of the two circular marks. When
* in gen_grid_rectification_map() the parameter Rotation is 'auto', the rectified
* image is rotated such that the black mark is left of the white mark.

* Determine region of interest
MinContrast := 25
Radius := 10

// 定位到需要矫正的网格区域
find_rectification_grid (Image, GridRegion, MinContrast, Radius)

dev_display (GridRegion)
disp_message (WindowID1, 'Grid region', 'window', 12, 12, 'black', 'true')
disp_continue_message (WindowID1, 'black', 'true')
stop ()
reduce_domain (Image, GridRegion, ImageReduced)

* Determine grid points
SigmaSaddlePoints := 1.5
Threshold := 5

// 检测一副图像中的亚像素鞍点,输出定位到的点的坐标

saddle_points_sub_pix (ImageReduced, 'facet', SigmaSaddlePoints, Threshold, Row, Col)

dev_set_color ('blue')
gen_cross_contour_xld (SaddlePoints, Row, Col, 6, 0.785398)
dev_display (Image)
dev_display (SaddlePoints)
disp_message (WindowID1, 'Grid points', 'window', 12, 12, 'black', 'true')
disp_continue_message (WindowID1, 'black', 'true')
stop ()

* Connect points to grid
SigmaConnectGridPoints := 0.9
MaxDist := 5.0
GridSpacing := 20
dev_set_color ('red')

// 把矫正过后的网格点连接成线

connect_grid_points (ImageReduced, ConnectingLines, Row, Col, SigmaConnectGridPoints, MaxDist)

dev_display (ConnectingLines)
disp_message (WindowID1, 'Connected grid points', 'window', 12, 12, 'black', 'true')
disp_continue_message (WindowID1, 'black', 'true')
stop ()

* Determine image map

// 生成映射关系

gen_grid_rectification_map (ImageReduced, ConnectingLines, Map, Meshes, GridSpacing, 0, Row, Col, 'bilinear')
map_image (ImageReduced, Map, ImageMapped)

get_image_size (Map, MapWidth, MapHeight)
dev_open_window (0, (ImageWidth * 0.75) + 12, MapWidth, MapHeight, 'black', WindowID2)
set_display_font (WindowID2, 14, 'mono', 'true', 'false')
dev_display (ImageMapped)
disp_message (WindowID2, 'Rectified grid', 'window', 12, 12, 'black', 'true')
stop ()


* Part 2: Application of the image map
* The original surface (without the checkered pattern) is rectified
* using the previously calculated image map.

* Read in the image to be rectified
read_image (Image, 'can')

* Rectify image using the previously calculated image map
dev_set_window (WindowID2)
map_image (Image, Map, ImageMapped)

dev_set_window (WindowID1)
dev_display (Image)
disp_message (WindowID1, 'Original image', 'window', 12, 12, 'black', 'true')
dev_set_window (WindowID2)
dev_display (ImageMapped)
disp_message (WindowID2, 'Rectified image', 'window', 12, 12, 'black', 'true')

                                                     图1 矫正前

 

                                   图2:矫正后

 

 

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: Halcon 10.0 是一款强大的机器视觉开发软件,支持在Windows系统上运行。halcon10.0-windows.exe 是Halcon 10.0 软件的可执行文件,用于在Windows系统上安装和运行该软件。 通过运行 halcon10.0-windows.exe 文件,用户可以开始安装Halcon 10.0 软件。安装过程中,用户需要按照提供的安装向导进行操作,包括选择安装路径、设置组件和功能、以及输入必要的许可证信息等。完成安装后,用户可以在自己的计算机上打开Halcon 10.0 软件。 Halcon 10.0 软件提供了丰富的功能和工具,用于开发和实现机器视觉应用。它支持图像处理、图像分析、模式匹配、三维视觉、相机校准等多项功能。用户可以通过Halcon 10.0 软件进行图像的预处理、特征提取、目标识别和测量等操作,从而实现各种视觉检测和测量任务。 除了功能强大的视觉算法和工具,Halcon 10.0 软件还提供了友好的用户界面和丰富的编程接口,使得用户可以根据自己的需求进行定制化开发和编程。用户可以通过编写脚本或使用常见的编程语言如C++、C#等来编写自己的机器视觉应用程序。 总而言之,halcon10.0-windows.exe 是Halcon 10.0 软件的安装文件,通过安装和运行该软件,用户可以方便地进行机器视觉应用的开发和实现。 ### 回答2: Halcon 10.0-windows.exe是一种软件程序,它是由MVTec Software GmbH开发的一款专业机器视觉软件。Halcon被广泛应用于各种工业领域,如制造业、物流、医疗等,用于图像处理、检测、识别和测量等方面的任务。 Halcon 10.0-windows.exe是Halcon 10.0版本的Windows操作系统的可执行文件。这意味着它可以在Windows操作系统上运行,并且可以直接从该可执行文件启动Halcon 10.0软件。 Halcon 10.0是Halcon软件最新的一个重要版本,它引入了许多新功能和改进,以提供更好的机器视觉解决方案。该版本具有更高的性能、更强大的图像处理能力和更便捷的用户界面。用户可以使用Halcon 10.0进行图像分析、模式识别、目标检测、形状测量等任务。此外,Halcon 10.0还支持多种编程语言和平台,并提供了丰富的开发工具和函数库,以便用户根据自己的需求进行定制和扩展。 对于使用Halcon进行机器视觉应用的用户来说,Halcon 10.0-windows.exe是一个非常重要的文件,它提供了启动Halcon 10.0软件的能力。用户只需双击该文件,就可以快速启动Halcon 10.0,并开始使用其功能进行图像处理和分析。对于那些希望在Windows操作系统上进行机器视觉开发和应用的用户来说,Halcon 10.0-windows.exe无疑是一个不可或缺的工具。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值