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.
Harvester Access USB3Camera Data
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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment