Common Vision Blox 15.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Friends Modules Pages
MockTL

CVMockTL

CVMockTL is a simulated GenTL producer that provides an interface, devices and streams without relying on any physical hardware.

Usage

The CVMockTL can be discovered and opened like any other device. The only thing required is the usage of the IncludeMockTL flag when programatically discovering devices, otherwise the CVMockTL will not be found.

For more information see the Device Discovery Documentation.

var discoveredDevices = DeviceFactory.Discover(DiscoverFlags.IncludeMockTL);
static DiscoveryInformationList Discover()

#include <cvb/device_factory>
auto discoveredDevices = Cvb::DeviceFactory::Discover(Cvb::DiscoverFlags.IncludeMockTl);
static std::vector< DiscoveryInformation > Discover()
DiscoverFlags

import cvb
discoveredDevices = cvb.DeviceFactory.discover_from_root(cvb.DiscoverFlags.IncludeMockTL)
List[cvb.DiscoveryInformation] discover_from_root(int flags=cvb.DiscoverFlags.FindAll, int time_span=300)

Configuration

The CVMockTL can be configured via a CVMockTL.json file.

This file can either be placed locally (residing in the working directory of the application that should use the CVMockTL) or globally (residing in *%cvbdata%\Drivers*).

The CVMockTL.json placed locally will take priority over the global one.

By default no CVMockTL.json file is deployed when installing CVB. A default file will be created when first opening the CVMockTL. The user has to take care of adapting the CVMockTL.json file.

This is how a default CVMockTL.json file looks like:

{
"ID" : "CVMockTL.cti",
"Interfaces" : [
{
"ID" : "MyInterface0",
"Devices" : [
{
"ID" : "MyDevice0",
"SerialNumber" : "12345",
"UserName" : "MockDevice",
"Model" : "Mock Camera (Default)",
"Version" : "1.0",
"Streams" : [
{
"ID" : "MyStream0",
"Width" : 640,
"Height" : 480,
"PixelFormat" : "Mono8"
},
{
"ID" : "MyStream1",
"PixelFormat" : "Mono16"
},
{
"ID" : "MyStream2",
"PixelFormat" : "RGB8"
},
{
"ID" : "MyStream3",
"PixelFormat" : "RGB10"
}
]
}
]
}
]
}

It defines a single interface, with a single device having four different streams. If Width and Height are not set, the stream will assume a default value of 1920x1080. If PixelFormat is not set, Mono8 will be assumed.

Furthermore the following other pixel formats are supported:

  • Mono12p
  • BayerBG12p
  • BayerRG12p
  • BayerGB12p
  • BayerGR12p
Key Type Description Mandatory
Devices Array A list of available devices. Each entry describes one device.

Inside each device object:

Key Type Description Mandatory
ID String Unique identifier for the device
SerialNumber String Serial number of the device
UserName String User-defined name for the device
Model String Model name of the device
Version String Firmware or hardware version of the device
Streams Array List of available data streams for the device

Inside each stream object:

Key Type Description Mandatory
ID String Unique identifier for the stream.
Width Integer Width of the image stream in pixels
Height Integer Height of the image stream in pixels
PixelFormat String Format of pixel data (e.g., Mono8, Mono16, RGB8, RGB10)
ImageDirectoryPath String Filesystem path to a directory containing images to stream
ImageOrder Array[String] Ordered list of image file paths to load from disk

Streaming image files from disk

To stream image files from disk when using the CVMockTL you can use the ImageDirectoryPath property. A relative path is interpreted based on the current working directory.

"Streams" : [
{
"ID" : "MyStream0",
"ImageDirectoryPath" : "C:\\path\\to\\a\\directory"
}
]

When using the ImageDirectoryPath property, the Width, Height and PixelFormat properties are ignored.

To specify a list of image file paths, the ImageOrder key is used. The value describes a list of image files to load in the specified order. If a client wants to load:

  • image_2.tif
  • image_0.tif
  • image_1.tif

in that order, he should write the configuration file as follows:

"Streams" : [
{
"ID" : "MyStream0",
"ImageOrder" : [
"/path/to/image_2.tif",
"/path/to/image_0.tif",
"/path/to/image_1.tif"
]
}
]

The following things need to be considered when streaming images from disk:

  • Once the last image has been streamed, it will loop back to streaming the first image.
  • When the grab is stopped and started again streaming will continue with the next image.