在 HALCON/Python 中,您可以作为非成员函数直接调用 HALCON 操作符,并通过顶层的 halcon 模块直接公开。
以下代码使用帧捕获器抓取图像序列的第一幅图像,并在窗口中显示该图像:
framegrabber = ha.open_framegrabber( name='File', horizontal_resolution=1, vertical_resolution=1, image_width=0, image_height=0, start_row=0, start_column=0, field='default', bits_per_channel=-1, color_space='default', generic=-1, external_trigger='default', camera_type='board/board.seq', device='default', port=1, line_in=-1 ) img = ha.grab_image(framegrabber) width, height = ha.get_image_size_s(img) window = ha.open_window( row=0, column=0, width=width, height=height, father_window=0, mode='visible', machine='' ) ha.disp_obj(img, window)
有关示例的详细内容,请参见后续小节。