Hi,
I’m looking for some help with acquiring images using CVB Python from multiple cameras.
Hardware, 2 USB cameras:
Alvium 1800U-158C-CH-C
There is no hardware trigger, and I’d like to keep it this way. I accept this will lead to mis-matches between the camera acquisition, but would like to still get some initial results to assess this.
System software versions:
Windows 11
Common Vision Blox Image Manager v13.04.005
Python 3.9
CVB python 1.4
When setup in GenICam Browser, the cameras are achieving 250 FPS. I have saved those settings into user sets for each camera, and saved them as configured devices.
I’ve run the streaming simple, streaming parallel and streaming async examples succesfully with one camera plugged in. Problems occur when I add in the second camera.
The below is an attempt to use a MultiStreamHandler. I have also attempted similar with the async acquire example. In both cases, the software hangs and doesn’t acquire any images (but was working with the Mock drivers):
import datetime
import cvb
import time
import os
class MyStreamHandler(cvb.MultiStreamHandler):
def __init__(self, stream_list):
super().__init__(stream_list)
self.rate_counter = cvb.RateCounter()
# called from the aqusition thread
def handle_async_stream(self, stream_list):
super().handle_async_stream(stream_list)
print("handle_async_stream")
# called from the aqusition thread
def handle_async_wait_result(self, wait_result_list):
super().handle_async_wait_result(wait_result_list)
self.rate_counter.step()
image1, status1 = wait_result_list[0]
image2, status2 = wait_result_list[1]
print("1 image: " + image1.__class__.__name__ + " " + str(image1) + " | Status: " + str(status1) + " | Buffer Index: " + str(image1.buffer_index))
print("2 image: " + image2.__class__.__name__ + " " + str(image2) + " | Status: " + str(status2) + " | Buffer Index: " + str(image2.buffer_index))
# print messurement results
def eval(self):
print("Acquired with: " + str(self.rate_counter.rate) + " fps")
device1 = cvb.DeviceFactory.open(os.path.join(cvb.install_path(), "drivers", "GenICam.vin"), port=0)
device2 = cvb.DeviceFactory.open(os.path.join(cvb.install_path(), "drivers", "GenICam.vin"), port=1)
stream1 = device1.stream()
stream2 = device2.stream()
stream1.ring_buffer.change_count(200, 0)
stream2.ring_buffer.change_count(200, 0)
print("Setup done")
start_time = datetime.datetime.now()
with MyStreamHandler([stream1, stream2]) as handler:
handler.run()
time.sleep(5)
handler.finish()
print("Took {} seconds".format(datetime.datetime.now() - start_time))
Is there anything that you can spot that I’m doing incorrectly?
Thanks,
Alex