Hi all,
I am working on a moving camera setup, every time the camera arrives at a specified location in the plane I call a function save_images(). There are 3 images to be saved per position, 1 bayered image I want to debayer, and two images in the Near Infra Red. When running my save_images() method for the first time ( = at the first position ) , no problem occurs. When the camera moves on to the next positions and the save_images() get’s called for the second time, a watermark appears on the debayerd image. How can I solve this problem?
Thanks in advance
The code of the save_images() method :
save_images(self, folder_name : str , ipos : int):
"""This method saves the images as a numpy array to a certain folder_name,
ipos is an integer which tells us to which measurement the image belongs"""
devices = cvb.DeviceFactory.discover_from_root(cvb.DiscoverFlags.IgnoreVins)
with cvb.DeviceFactory.open(devices[0].access_token, cvb.AcquisitionStack.GenTL) as device:
streams = [device.stream(cvb.ImageStream, i) for i in range(device.stream_count)]
for stream in streams:
stream.engine_start()
for stream in streams:
stream.device_start()
for i in range(1):
images = [stream.wait() for stream in streams]
try:
pass
finally:
image_no = 1
for image, status, nodes in images:
if image_no == 1 :
image = cvb.foundation.bayer_to_rgb(image,1,1)
filename = os.path.join(folder_name + '\\' + str(ipos) + '_' + str(image_no) + '.jpg')
print(filename)
nparrayim = cvb.as_array(image)
plt.imsave(filename, nparrayim)
image_no += 1
with image:
print("Acquired image: " + str(i) + " | Timestamp: " + str(image.raw_timestamp))
for stream in streams:
stream.device_abort()
for stream in streams:
stream.engine_abort()```