Skip to content

Instantly share code, notes, and snippets.

@immengineer
Last active July 9, 2019 11:11
Show Gist options
  • Save immengineer/0eec5b1dd37255732b6825ff1c5fa76a to your computer and use it in GitHub Desktop.
Save immengineer/0eec5b1dd37255732b6825ff1c5fa76a to your computer and use it in GitHub Desktop.

Revisions

  1. immengineer revised this gist May 7, 2019. No changes.
  2. immengineer created this gist May 7, 2019.
    25 changes: 25 additions & 0 deletions GenTLUSB3-2.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    from harvesters.core import Harvester
    h = Harvester()
    h.add_cti_file('C:/Program Files/JAI/SDK/bin/JaiUSB3vTL.cti')
    h.update_device_info_list()
    print("NumberOfCamera = {0}".format(len(h.device_info_list)))
    print(h.device_info_list[0])
    ia = h.create_image_acquirer(0)
    ia.device.node_map.PixelFormat.value = 'BayerRG8'
    ia.device.node_map.TestPattern = 'HorizontalColorBar'
    ia.start_image_acquisition()
    i=0
    while i<1:
    with ia.fetch_buffer() as buffer:
    component = buffer.payload.components[0]
    print ("Data_format = {0}".format(component.data_format))
    print ("Image_height = {0}".format(component.height))
    print ("Image_width = {0}".format(component.width))
    print ("Components_per_pixel = {0}".format(component.num_components_per_pixel))
    print ("Class type = {0}".format(type(component.data)))
    print ("Image = {0}".format(component.data[0:4])) # Colorbar White
    print ("Image = {0}".format(component.data[484:488])) # ColorBar Cyan
    i = i + 1
    ia.stop_image_acquisition()
    ia.destroy()
    h.reset()