# # 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. role = dev.select_role(UniTAP.dev.UCD500.DPSourceDPSink) rx_port = role.dprx # role = dev.select_role(UniTAP.dev.UCD323.HDMISink) # rx_port = role.hdrx # First variant of capturing = set frame count number rx_port.video_capturer.start(frames_count=60, capture_type=UniTAP.CaptureConfig.Type.BUFFERED) rx_port.video_capturer.stop() result = rx_port.video_capturer.capture_result # Save captured frames # file_format - BIN, PPM and BMP # path - full path to save the image # index - index of captured image for i in range(len(result.buffer)): result.save_image_to_file(file_format=UniTAP.PictureFileFormat.BMP, path=f"./results/image_{i}", index=i) # # 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()