import platform
import os
if(platform.system() == 'Windows'):
import sys
import msvcrt
if (sys.version_info.major >= 3 and sys.version_info.minor >= 8):
#Following lines specifying, the location of DLLs, are required for Python Versions 3.8 and greater
os.add_dll_directory("C:\BitFlow SDK 6.5\Bin64")
os.add_dll_directory("C:\Program Files\CameraLink\Serial")
import BFModule.BufferAcquisition as Buf
import BFModule.Display as Disp
import time
def main():
print('Read Images Example')
print('----------------------')
numBuffers = 10
cirAq = Buf.clsCircularAcquisition()
#Call Open board function by showing the Board select dialog
cirAq.Open()
#Allocate the requested number of buffers
BufArr = cirAq.BufferSetup(numBuffers)
#Read the image files "Image_x.tiff"
try:
cirAq.ReadImageFiles("Image_0000.TIFF", numBuffers)
except Exception as e:
print('ReadImageFiles error: ', e)
else:
#Create Display instance
disp = Disp.clsDisp(cirAq)
#Open display window
disp.Open()
print('\nDisplaying images . . .')
print('Hit: \n \'L\' to loop through all images once, \n \'N\' to loop through one image at a time')
flag = False
loop = False
while(not(flag)):
val = input()
if (val.upper() == 'L'):
loop = True
flag = True
elif(val.upper() == 'N'):
loop = False
flag = True
else:
print('Invalid Entry.')
loop = False
flag = False
for i in range(0, numBuffers):
print('\tDisplaying frame', (i+1), 'of ', numBuffers, '\r', end="")
disp.Update(BufArr[i])
if(loop):
time.sleep(0.25)
else:
input()
input("\nPress the Return key to exit.")
disp.Close()
cirAq.BufferCleanup()
cirAq.Close()
if __name__ == "__main__":
main()