工控编程吧

标题: 工业视觉halcon图形output函数详细介绍 [打印本页]

作者: qq263946146    时间: 2019-11-6 12:44
标题: 工业视觉halcon图形output函数详细介绍
有时在我们编写视觉代码时,会将一些图形临时显示出来,查看效果。
Halcon提供有相关函数,这些函数多以disp_打头。
我们下面在halcon中查看与运行这些函数。
了解其使用与实现效果。

dev_close_window ()
dev_open_window (0, 0, 512, 512, 'black', WindowHandle)

disp_arc (WindowHandle, 64, 64, 3.14159, 32, 32)
disp_arrow (WindowHandle, 10, 10, 118, 118, 3)
disp_circle (WindowHandle, 64, 64, 64)

disp_cross (WindowHandle, 200, 200, 240, rad(30))
disp_ellipse (WindowHandle, 64, 64, 0, 12, 14)
disp_line (WindowHandle, 32, 32, 64, 64)
disp_polygon (WindowHandle, [16,80,80], [48,16,80])
disp_rectangle1 (WindowHandle, 16, 16, 48, 80)
disp_rectangle2 (WindowHandle, 48, 64, rad(45), 48, 32)
read_image (Image, 'patras')
disp_channel (Image, WindowHandle, 3)
global tuple gTerminationButtonLabel
gTerminationButtonLabel:='continue'
disp_continue_button (WindowHandle)
*disp_color
*disp_image
*disp_obj
*disp_region
*disp_xld


disp_3d_coord_system (WindowHandle, ['area_scan_division',0.012,0.0,5e-6,5e-6,320,240,640,480], [0.0,0.0,1.0,0.0,0.0,0.0,0], 0.05)

X := [-rad(180): 0.01: rad(180)]
Y1 := sin(X)
Y2 := (X * X) * 0.2 - 1
XLabel := 'x'
YLabel := 'y'
Color := ['medium slate blue', 'yellow']
GenParamName := []
GenParamValue := []
plot_tuple (WindowHandle, X, [Y1, Y2], XLabel, YLabel, Color, GenParamName, GenParamValue)
X := [-rad(180): 0.01: rad(180)]
Y := sin(X)
create_funct_1d_pairs (X, Y, Function)
GenParamName := []
GenParamValue := []
plot_funct_1d (WindowHandle, Function, 'x', 'sin^-1(x)', 'red', GenParamName, GenParamValue)


gen_cam_par_area_scan_division (0.025, 0, 1.1e-05, 1.1e-05, 384.0, 288.0, 768, 576, CameraParam)
create_pose (-0.037, 0.026, 0.42, 137, 52, 326, 'Rp+T', 'gba', 'point', Pose)
read_object_model_3d ('pipe_joint', 'm', 'convert_to_triangles', 'true', PipeJointOM3DID, Status)
disp_object_model_3d (WindowHandle, PipeJointOM3DID, CameraParam, Pose, [], [])
disp_object_model_3d_safe (WindowHandle, PipeJointOM3DID, CameraParam, Pose, [], [])
disp_object_model_no_opengl (ModelContours, PipeJointOM3DID, [], [], WindowHandle, CameraParam, Pose)
visualize_object_model_3d (WindowHandle, PipeJointOM3DID, CameraParam, Pose, [], [], [], [], [], PoseOut)
get_object_models_center (PipeJointOM3DID, Center)
determine_optimum_pose_distance (PipeJointOM3DID, CameraParam, 0.9, PoseOut, PoseOut1)

* Create a new scene
  create_scene_3d (Scene)
  add_scene_3d_camera (Scene, CameraParam, CameraIndex)
  add_scene_3d_light (Scene, [42.0, 42.0, 42.0], 'point_light', LightIndex)
  add_scene_3d_instance (Scene, PipeJointOM3DID, Pose, InstanceIndex)
  set_scene_3d_instance_param (Scene, InstanceIndex, 'alpha', 0.9)

  display_scene_3d (WindowHandle, Scene, CameraIndex)
* clear_scene_3d (Scene)
global tuple gAlphaDeselected
gAlphaDeselected := 0.3
  dump_image_output (Image, WindowHandle, Scene, InstanceIndex, PipeJointOM3DID, [], [], CameraParam, Pose, 1, '', '', '', 0, 0, 0, 0, 0, 0, GenParamValue, 0)
dump_window (WindowHandle, 'jpg', 'halcon_dump')
帖子为视频教程的部分内容,
可以下载教程学习。
[halcon]1[/halcon]
[MFC408]1[/MFC408]
[weixinlianxi]1[/weixinlianxi]








欢迎光临 工控编程吧 (https://www.gkbc8.com/) Powered by Discuz! X3.4