Port IMAGE - DEFAULT¶
Default port for interaction with the frame grabber
Stimulation¶
This port has no stimulus capabilities.
Specifics¶
In addition to the image data this port can access the I/O ports of the frame grabber. This can be done with the port jobs or the option Show state of I/O ports in video that writes the current state of the I/O ports in the upper right corner of the recorded video:
Every pixel represents the state of an I/O port in ascending order from right to left. A pixel value greater than 128 represents one, otherwise zero.
The frame grabber in the example image has configured 6 input and 6 output ports. The first 6 pixels are for input and the remaining for output:
Input: [1, 0, 1, 1, 0, 1]
Output: [0, 1, 0, 1, 0, 0]
The option Show binary timestamp in video works in a similar way. The current timestamp of the grabber in nanoseconds is stored in a 64 bit unsigned integer and written to the first 64 pixels in the upper left corner of the frame. A pixel value greater than 128 corresponds to a one, otherwise zero. The most significant bit is the first one (big-endian).
So this example image corresponds to 345959656981240 nanoseconds:
The following sample code can be used to read the binary timestamp from an image and convert it to a Unix timestamp:
import numpy as np
def ReadTimestampFromImage(image: np.ndarray):
"""
The grabber can write 64 bit binary timestamps into a video frame. This corresponds to ns
since 01.01.1970. As standard, the timestamps will appear in the top left corner of the
frame, each pixel corresponding to one bit.
:param image: Raw matrix of the image, e.g. image.ToGrayscale().GetData()
:type image: np.ndarray
"""
# convert first 64 pixels of image to binary array
rawTs = image[0, 0:64, 0] > 125
# convert logical array to number
nanoSecondTs = 0
for i in range(64):
nanoSecondTs |= int(rawTs[63-i]) << i
# Return the timestamp in seconds
return nanoSecondTs / 1e9
Properties 🛈¶
Name |
Available if |
Default value |
Valid values |
Type |
Description |
|---|---|---|---|---|---|
Frame grabber interface name |
[ONLINE] |
string |
Name of the LVDS interface which serves as frame grabber. |
||
LVDS channel |
0 |
int |
LVDS channel for interfaces supporting multiple LVDS channels. |
||
Name of I/O interface |
[ONLINE] |
string |
Name of I/O interface. |
||
Software reset on tool start |
☐ |
bool |
Performs a software reset on the LVDS device before loading the config and start grabbing. |
||
Configuration |
use existing |
[use existing, load file] Display values:
|
string |
This option determines whether Eecu.test should load an XML configuration file to the hardware at the beginning of the connection setup. Alternatively, the existing configuration is used. In this case, the connection to the frame grabber must be set up manually via DragonSuite before. |
|
Path to the configuration file |
Configuration: ‘load file’ |
uri |
Path to the XML configuration file with which the LVDS interface is to be configured. Such an XML file can be generated via DragonSuite. |
||
Show state of I/O ports in video |
☐ |
bool |
Shows the current state of I/O ports in the right upper corner of the video. |
||
Show binary timestamp in video |
☐ |
bool |
The current timestamp of the grabber in nanoseconds is stored in a 64 bit unsigned integer and written to the first 64 pixels in the upper left corner of the frame. |
||
Swap red and blue |
☐ |
bool |
Sets the color channel layout to BGR, instead of RGB. |
||
Live preview |
☐ |
bool |
Streams a live preview on the configured network port. The live stream is available under the toolhost’s IP address and the configured port, e.g. for a local tool connection: http://127.0.0.1:<port> |
||
Open preview window |
Live preview |
☑ |
bool |
Opens a preview window upon loading the configuration. This window displays the current output of the image source as a livestream and will remain open as long as the test configuration is active. |
|
Port |
Live preview |
‘<auto>’ |
string |
The network port that will be used for live streaming. Every live stream needs an unique port if live streaming is enabled for multiple video sources. If the value is set to <auto> a free network port will be defined by the system. |
|
Show text overlay in video recordings |
☐ |
bool |
Adds a text overlay with the format “timestamp package name” in the bottom left corner of video recordings. |
Jobs 🛈¶
ReadDigitalInputs¶
Reads the current state of all digital inputs and returns them as a list
Parameterization
Return value
Name |
Available if |
Default value |
Valid values |
Type |
Description |
|---|---|---|---|---|---|
return |
object |
List with states of all input ports |
ReadDigitalOutputs¶
Reads the current state of all digital outputs and returns them as a list
Parameterization
Return value
Name |
Available if |
Default value |
Valid values |
Type |
Description |
|---|---|---|---|---|---|
return |
object |
List with states of all output ports |
WriteDigitalOutput¶
Writes value to digital output port
Parameterization
Parameter
Name |
Available if |
Default value |
Valid values |
Type |
Description |
|---|---|---|---|---|---|
port |
1 |
int |
Index of the output port starting with 1 |
||
value |
☐ |
bool |
New state of the output port |