Image Streamer Driver Module by Automation Professionals
E-Mail Support
Return

Scripting

Generic Image Manipulation Helpers

Function jpegFromImage()

system.streamer.jpegFromImage(image, quality)

Argument Data Type Description
image RenderedImage Any source image that implements the RenderedImage interface, typically a BufferedImage.
quality Float The quality factor to use, 0.0 to 1.0.
Returns: byte[] The JPEG compressed binary file content.

Keyence CV-5000 Command Channel

Function sendCV5kCommand()

system.streamer.sendCV5kCommand(device, cmd[, binary])

Argument Data Type Description
device String The name of the CV-5000 device instance.
cmd String The command and arguments to send, delimited by commas, without any end-of-line character. Do not include the length (in bytes) of any binary payload.
binary byte[] Optional binary payload to be encoded at the tail of the command. The length argument and check byte are computed and included automatically. If omitted or None, the command is terminated with the normal carriage return.
Returns: CV5kCommand A subclass of CompletableFuture <CV5kResponse> with the extra properties described below.

Class CV5kCommand

Property Data Type Description
cmd String The leading fragment of the complete command (before any comma) that indicates the overall operation being performed.
params String[] The remaining arguments of the command, if any, as an array of strings. Does not (must not) include the length of any binary payload.
binary byte[] Optional binary payload that will be encoded on send, or None.

The .get() method of the CompletableFuture above yields a CV5kResponse instance with the following properties:

Class CV5kResponse

Property Data Type Description
cmd String The leading fragment of the complete response (before any comma) that indicates the overall operation performed. Typically matches the command sent. Will be ER if the vision controller is reporting an error.
params String[] The remaining arguments of the response, split on commas, as an array of strings. If cmd is one of BC, BR, SA, SR, or SW, then a binary payload length has been stripped from params and used to extract the payload.
binary byte[] Binary payload, if extracted from a supported command's response.
delimiter Integer Code point that terminated the command. Usually 0x2c if a binary payload was decoded, otherwise a carriage return.
e Exception If reception or decoding was interrupted or invalid at any point, the exception is delivered here. Under normal conditions, the Future does not complete exceptionally.

OpenCV

Numerous OpenCV classes, constants, and functions are exposed under the system.cv2 namespace, with additional modules nested within (depending on OpenCV version). Since a wide range of versions are supported, they will not be documented here. Refer to the OpenCV documentation itself.

Note that the jython interpreter Ignition uses is not compatible with the numpy library that OpenCV's generic python bindings use. The OpenCV API exposed to jython is the java API, which wraps the Mat interface to OpenCV's native C++ matrix data type.

OpenCV python code known to work with CPython will have to be almost completely rewritten to follow the method signatures from the java/C++ API, and work with instances of Mat instead of the corresponding numpy types. Also note that while most classes and functions are present, the namespaces are not quite identical. Explore the system.cv2 namespace with code like the following:

from system import cv2
for x in dir(cv2):
    print "%50s : %s" % (x, type(getattr(cv2, x)))

Note that different results will be obtained in different scopes if different OpenCV versions are used.

Return