I have images from a video and a look-up table with indexes. The goal is to make a new image from each frame by using the indexes in the look-up table. My code work using my laptop, but bit slow. My aim is to make it to work in TX2. Below is my code, not sure why it is slow.
cap1 = cv2.VideoCapture(2)
with open('lookup_table.pkl', 'rb') as f:
lut_idx = pickle.load(f)
channels = 3 # Colored images
dim = 480 # Square image 480 x480
while (cap1.isOpened()):
ret1, left = cap1.read()
if ret1 == True:
newImg = np.reshape(np.reshape(together, (dim * dim , channels))[lut_idx],
(dim, dim, channels))
cv2.imshow('newImage', newImg) # Show image
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap1.release()
cv2.destroyAllWindows()
What can I do to make it faster? Should I look into parallel processing? Any help is welcome. Thanks