Error message
| During the execution of a Vision application, an error message similar to the following appears. At the same time, TwinCAT enters the EXCEPTION state.
This message indicates that there is a conflict in the execution of a Vision function that could not be intercepted. This essentially refers to the correct format of the input data and should only occur if the function is not used in accordance with the API reference. The error specification behind "VisionError: Assertion failed" may vary depending on the use case.
|
Solution with F_VN_ConvertColorSpace
| An image can be either single-channel or multi-channel. For certain function calls, an image with a defined number of channels is expected. For example with the function F_VN_ConvertColorSpace , where the enum ETcVnColorSpaceTransform is used to specify the format of the input image. If Engineering is logged in, the corresponding function call is marked in the PLC code. The function F_VN_GetPixelFormat , which returns the actual number of channels, can help to analyze why the actual number of channels differs from the expected number.
Typical causes:
- File Source Control
In File Source a different image format is set than expected or the image format is set to "Original Format from File" and the actual image format is different than expected. For example, images that look monochrome are not always stored as monochrome images (single-channel image). - Camera
For many cameras, the pixel format can be set in the configuration. Depending on the selected format, the number of image channels also changes. - Previous processing steps
A previous function call may have changed the image and thus also the number of channels.
|