halcon二 图像校正

1.get_image_size(Image : : : WidthHeight)

返回图像的尺寸。

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

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

3.gen_image_to_world_plane_map( : Map : CameraParamWorldPoseWidthInHeightIn,WidthMappedHeightMappedScaleMapType : )

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

包含了映射数据。

4.map_image(ImageMap : ImageMapped : : )

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

5.image_to_world_plane(Image : ImageWorld : CameraParamWorldPoseWidthHeightScale,Interpolation : )

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

6.image_points_to_world_plane( : : CameraParamWorldPoseRowsColsScale : XY)

把图像上的点转换到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‘)

原文地址:https://www.cnblogs.com/6-6-8-8/p/9549596.html

时间: 2024-08-02 11:34:01

halcon二 图像校正的相关文章

采用QHD分辨率使用kinect2_calibration,完成QHD图像校正

//.................................................................................//采用QHD分辨率使用kinect2_calibration,完成QHD图像校正参考"http://www.bubuko.com/infodetail-2151412.html"1.修改kinect2_calibration.cpp文件如下:a)K2_TOPIC_HD 改为 K2_TOPIC_QHDb)把文件中涉及到分辨

Halcon二维仿射变换实例探究

二维仿射变换,顾名思义就是在二维平面内,对对象进行平移.旋转.缩放等变换的行为(当然还有其他的变换,这里仅论述这三种最常见的). Halcon中进行仿射变换的常见步骤如下: ① 通过hom_mat2d_identity算子创建一个初始化矩阵(即[1.0, 0.0, 0.0, 0.0, 1.0, 0.0]): ② 在初始化矩阵的基础上,使用hom_mat2d_translate(平移).hom_mat2d_rotate(旋转).hom_mat2d_scale(缩放)等生成仿射变换矩阵:(这几个算子

Halcon二维码识别(创建-训练-识别-清除)

**********************初阶,创建-识别-清除*************************** create_data_code_2d_model ('QR Code', [], [], DataCodeHandle) read_image(Image1,'C:/Users/研发/Pictures/Saved Pictures/二维码/123456.PNG') find_data_code_2d(Image1, SymbolXLDs1, DataCodeHandle,

OpenCV基础(二)---图像像素操作

图像像素操作 通过访问图像的像素,对灰度图像和RGB图像进行反差. 例如,在灰度图像中,某一个像素值为,pixel_value. 那么反差后的pixel_value = 255 - pixel_value. 对RGB图像处理类似,差别在于要对每一个颜色通道进行反差. 方法1: 1 #include <opencv2/opencv.hpp> 2 #include <iostream> 3 4 using namespace cv; 5 using namespace std; 6 7

VS2017+opencv3.3 图像校正遇到两个问题

在修改代码的时候发现的错误,相机阵列 1:error C2664 解决方式:"属性→配置属性→常规→项目默认值→字符集",默认的选项是"使用多字节字符集",将它改为"使用Unicode字符集"即可. 2:Link2019 和 link1120(DSX相机阵列 合图) 解决方式:项目属性----附加依赖项:Shlwapi.lib 原文地址:https://www.cnblogs.com/augustosm/p/9159454.html

Halcon的二维码解码步骤和解码技巧

一.二维码简介 1 . 类型多样,常见的有QR Code二维码. Data Matrix二维码等. 2.高密度编码,信息容量大. 3.容错能力强,具有纠错功能:二维码因穿孔.污损等引起局部损坏时,照样可以正确得到识读,损毁面积达50%仍可恢复信息. 4.译码可靠性高:它比普通条码译码错误率百万分之二要低得多,误码率不超过千万分之一. 5.可引入加密措施:保密性.防伪性好. 二.图像预处理和二维码增强 对比度太低:scale_image(或使用外部程序scale_image_range),增强图像

基于HALCON的双目立体视觉系统实现

双目立体视觉是机器视觉的一种重要形式,它是基于视差原理并由多幅图像获取物体三维几何信息的方法.双目立体视觉系统一般由双摄像机从不同角度同时获得被测物的两幅数字图像,或由单摄像机在不同时刻从不同角度获得被测物的两幅数字图像,并基于视差原理恢复出物体   的三维几何信息,重建物体三维轮廓及位置.双目立体视觉系统在机器视觉领域有着广泛的应用前景. HALCON是在世界范围内广泛使用的机器视觉软件.它拥有满足您各类机器视觉应用需求的完善的开发库.HALCON也包含Blob分析.形态学.模式识别.测量.三

C#应用视频教程3.4 Halcon+C#测试

有了前面的基础后,我们来测试一下如何把程序做的更通用,首先是把初始化的方法修改一下,在初始化的时候传递过去HTuple这个对象(改成了全局的变量,以便于不同的方法调用) ? 其次需要有相机打开/相机关闭,图像保存/图像加载的功能(方便我们快速做测试),前面的相机操作已经讲过了,这里图像的加载也只是套用了前面的加载一个静态图像的功能(把绝对地址改成了参数),保存图像调用了Halcon的WriteImage方法 ? 这个方法可以参考范例write_image的这个范例学习(看他导出的C#的程序,稍微

OPENCV图像轮廓检测

前面在图像转换的时候学到canny算子,可以检测出图像的轮廓信息,但是,该算子检测到的轮廓信息还需要我们手动的用眼睛去识别,而实际工程应用中,我们需要得到轮廓的具体数学信息,这就涉及到今天的主题,图像轮廓检测. 一.图像轮廓检测 在opencv中,轮廓对应着一系列的点的集合,opencv提供了一个函数,用来获得这些点的集合 API:void finContours(输入图像,输出轮廓点集,输出向量,int 轮廓检索模式,int 轮廓近似方法,Point 轮廓点的可选偏移量) 注:1.输入图像,是