Getting Started with CVBpy

Loading Image Stream Sources

Loading images from disk is fine.

However, usually you will deal with live images from stream. A stream can either be a streming device like a camera, or a video (form disk) or a emulated stream composed from single images you.

Here is how you load a EMU file, that can be used to simulate your application with a defined set of images.

  1. Add the main module to your script.
import cvb
  1. Streams are provided by devices.
emu_device = cvb.DeviceFactory.open(cvb.install_path() + "Tutorial\\ClassicSwitch.emu")
  1. Now you can get the stream and a special device image
stream = emu_device.stream
device_image = emu_device.device_image
  1. Finally print some information.
print("Emu:")
print("Resolution: " + str(device_image.width) + " x " + str(device_image.height))
print("Frames: " + str(stream.image_count))

The output would be:

Emu:
Resolution: 640 x 480
Frames: 5

Additional information can be found at CVB.NET. With CVBpy things are quite similar.