15.2   Using HALCON Operators From HALCON/Python

In HALCON/Python, you call HALCON operators directly as non-member functions, exposed directly through the top level halcon module.

The following code grabs the first image of an image sequence using a framegrabber and displays the image in a window:

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)

See the subsequent sections for a breakdown of the example.