halcon二 圖像校訂

1.get_image_size(Image : : : WidthHeight)php

返回圖像的尺寸。app

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

Halcon內部程序,輸出爲圖像的比率和姿態。spa

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

產生一個投影映射,該映射描述圖像平面與Z=O的世界平面之間的關係,輸出爲圖像MAP,是一個多通道的圖像orm

包含了映射數據。blog

4.map_image(ImageMap : ImageMapped : : ) ip

利用映射變換校訂圖像,輸出爲矯正後的圖像。get

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

把校訂後的圖像轉換到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 imageImgPath := '3d_machine_vision/calib/'read_image (Image, ImgPath+'caliper_01')* Set the camera parameters for the imageCamParam := [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 appropriatelyget_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 := 652HeightMappedImage := 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 imagedev_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 imagegen_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 pointimage_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 imageimage_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')

相關文章
相關標籤/搜索