# # Import UniTAP module. # import UniTAP # # To initialize UniTAP library wrapper user should create UniTAP.TsiLib() object. # lUniTAP = UniTAP.TsiLib() # # For opening device, please, put serial number of the device as 8 symbol str or put index of device. # # dev = lUniTAP.open("NNNNNNNN") dev = lUniTAP.open(0) # After opening device as in UCD Console device role should be selected. # For UCD-500 available following roles: # UniTAP.dev.UCD500.DPSourceDPSink, USBCSourceUSBCSink, DPSourceUSBCSink and USBCSourceDPSink role = dev.select_role(UniTAP.dev.UCD500.DPSourceDPSink) # First variant of capturing = set frame count number role.dprx.video_capturer.start(frames_count=1, stream_number=1) role.dprx.video_capturer.stop() result = role.dprx.video_capturer.capture_result # Second variant of capturing = set number of second # role.dprx.video_capturer.start(sec=1) # role.dprx.video_capturer.stop() # result = role.dprx.video_capturer.capture_result # Third variant of capturing = capturing with user's stop command (without predefined number of frames or second) # role.dprx.video_capturer.start() # result = role.dprx.video_capturer.pop_element_as_result_object() # role.dprx.video_capturer.stop() # Save captured frames # file_format - BIN, PPM and BMP # path - full path to save the image # index - index of captured image result.save_image_to_file(file_format=UniTAP.PictureFileFormat.BMP, path="image.bmp", index=0) # # Since the 3.5 version, TsiLib and TSIDevice objects have the option to be closed earlier. # TSIDevice can be closed with the TsiLib method close(). TsiLib can be closed with cleanup(). # Clean up will close all opened devices and block ability to open any devices # with same TsiLib object. # lUniTAP.close(dev) lUniTAP.cleanup()