The ImageSource class

The ImageSource class provides a base class to be used for all kind of image providing devices, for example image processors.

For the cameras a more specific class is provided, see here.

The advantage of using this class, is that it can take care of creating the necessary output channels in the schema, and it provides functions to output images and End-of-Stream signals to them.

The class to be used in Python-bound devices is this one

class imageSourcePy.ImageSource.ImageSource(conf)[source]

Base class for image sources.

It provides two output channels - ‘output’ and ‘daqOutput’ - for sending out images, and three functions - ‘update_output_schema’, ‘write_channels’ and ‘signal_eos’.

The function ‘update_output_schema’ will update the schema for the output channels and make it fit for the DAQ.

The function ‘write_channels’ will write the input data to both the output channels, taking care of reshaping them for the DAQ.

The function ‘signal_eos’ will send an end-of-stream signal to both the output channels.

signal_eos()[source]

Send an end-of-stream signal to ‘output’ and ‘daqOutput’ channels

Returns:
update_output_schema(shape, encoding, k_type)[source]

Update the schema of ‘output’ and ‘daqOutput’ channels

Parameters:
  • shape – the shape of image, e.g. (height, width)
  • encoding – the encoding of the image. e.g. Encoding.GRAY
  • k_type – the data type, e.g. Types.UINT16
Returns:

write_channels(data, binning=None, bpp=None, encoding=None, roi_offsets=None, timestamp=None, **deprecated)[source]

Write an image to ‘output’ and ‘daqOutput’ channels

Parameters:
  • data – the image data as numpy.ndarray
  • binning – the image binning, e.g. (1, 1)
  • bpp – the bits-per-pixel, e.g. 12
  • encoding – the image encoding, e.g. Encoding.GRAY
  • roi_offsets – the ROI offset, e.g. (0, 0)
  • timestamp – the image timestamp - if none the current timestamp will be used
Returns:

whereas for middle-layers ones the class is

class imageSourcePy.ImageSourceMdl.ImageSource(configuration)[source]

Base class for image sources.

It provides two output channels - ‘output’ and ‘daqOutput’ - for sending out images, and three functions - ‘update_output_schema’, ‘write_channels’ and ‘signal_eos’.

The function ‘update_output_schema’ will update the schema for the output channels and make it fit for the DAQ.

The function ‘write_channels’ will write the input data to both the output channels, taking care of reshaping them for the DAQ.

The function ‘signal_eos’ will send an end-of-stream signal to both the output channels.

signal_eos()[source]

Send an end-of-stream signal to ‘output’ and ‘daqOutput’ channels

Returns:
update_output_schema(shape, encoding, dtype)[source]

Update the schema of ‘output’ and ‘daqOutput’ channels

Parameters:
  • shape – the shape of image, e.g. (height, width)
  • encoding – the encoding of the image. e.g. EncodingType.GRAY
  • dtype – the data type, e.g. UInt16
Returns:

write_channels(data, binning=None, bpp=None, encoding=None, roi_offsets=None, timestamp=None)[source]

Write an image to ‘output’ and ‘daqOutput’ channels

Parameters:
  • data – the image data as numpy.ndarray
  • binning – the image binning, e.g. (1, 1)
  • bpp – the bits-per-pixel, e.g. 12
  • encoding – the image encoding, e.g. EncodingType.GRAY
  • roi_offsets – the ROI offset, e.g. (0, 0)
  • timestamp – the image timestamp - if none the current timestamp will be used
Returns: