Acquire from a Camera
This is very simelar to the things shown above.
- load the device. This will open the first configured GenICam device.
vin_device = cvb.DeviceFactory.open(cvb.install_path() + "/drivers/GenICam.vin")
stream = vin_device.stream
- Before you can get any images start the stream.
stream.start()
- Wait for 10 images and print some information about them.
try:
for i in range(0 ,10):
image, status = stream.wait_for(1000)
if status == cvb.WaitStatus.Ok:
print("Acquired image " + str(i) + " into buffer " +
str(image.buffer_index) + ".")
else:
raise RuntimeError("timeout during wait"
if status == cvb.WaitStatus.Timeout else
"acquisition aborted")
except:
pass
finally:
stream.try_abort()
Please note that, although errors are unlikely in this simple example and I just pass them it is usually a good idea to handle them, and at least always stop the stream so that stay in a defined state.
The output given you have three (default) buffers allocated would be:
Acquired image 0 into buffer 0.
Acquired image 1 into buffer 1.
Acquired image 2 into buffer 2.
Acquired image 3 into buffer 0.
Acquired image 4 into buffer 1.
Acquired image 5 into buffer 2.
Acquired image 6 into buffer 0.
Acquired image 7 into buffer 1.
Acquired image 8 into buffer 2.
Acquired image 9 into buffer 0.