![]() |
IRSOL
C++ code implementing socket server for interacting with Baumer camera.
|
Utilities for interoperability between NeoAPI and OpenCV. More...
Namespaces | |
namespace | opencv |
Provides utilities for interoperability between NeoAPI and OpenCV. | |
Functions | |
cv::Mat | irsol::opencv::convertNeoImageToCvMat (const NeoAPI::Image &image) |
Converts a NeoAPI::Image (Mono12, non-packed) into an OpenCV cv::Mat . | |
cv::Mat | irsol::opencv::createCvMatFromIrsolServerBuffer (unsigned char *data, size_t rows, size_t cols) |
Creates an OpenCV cv::Mat from a raw buffer received from the IRSOL server. | |
Utilities for interoperability between NeoAPI and OpenCV.
This group contains functions and types that facilitate the conversion of Baumer NeoAPI images to OpenCV cv::Mat
objects. The group is only available if the OpenCV library is found on the user's computer at compilation time. If OpenCV is not detected, this header and its contents are excluded from the build.
cv::Mat irsol::opencv::convertNeoImageToCvMat | ( | const NeoAPI::Image & | image | ) |
Converts a NeoAPI::Image
(Mono12, non-packed) into an OpenCV cv::Mat
.
image | The NeoAPI::Image to convert containing 12-bit grayscale pixel data. Must be in unpacked Mono12 format (2 bytes per pixel, little endian). |
cv::Mat
of type CV_16UC1 with pixel values in range [0, 65535] (pixel raw values from the NeoAPI::Image 12bit depth are rescaled, so that 0 maps to 0 and 2^12-1 (=4095) maps to 2^16-1 (=65535))NeoAPI::Image
is valid and has an appropriate pixel format compatible with OpenCV. Definition at line 12 of file opencv.cpp.
cv::Mat irsol::opencv::createCvMatFromIrsolServerBuffer | ( | unsigned char * | data, |
size_t | rows, | ||
size_t | cols | ||
) |
Creates an OpenCV cv::Mat
from a raw buffer received from the IRSOL server.
This function takes a pointer to a buffer containing image data in unpacked Mono12 format (2 bytes per pixel, little endian, with bytes for each pixel swapped as sent by the server), and constructs a cv::Mat
of type CV_16UC1. The function swaps the bytes for each pixel to match OpenCV's expected order, copies the data into the matrix, and rescales the pixel values from 12-bit depth ([0, 4095]) to 16-bit depth ([0, 65535]).
data | Pointer to the raw image buffer. The buffer must contain at least rows * cols * 2 bytes. The data is modified in-place to swap bytes for each pixel. |
rows | Number of image rows (height). |
cols | Number of image columns (width). |
cv::Mat
of type CV_16UC1 containing the image data with pixel values rescaled to 16 bits.This function takes a pointer to a buffer containing image data in unpacked Mono12 format (2 bytes per pixel, little endian, with bytes for each pixel swapped as sent by the server), and constructs a cv::Mat
of type CV_16UC1. The function swaps the bytes for each pixel to match OpenCV's expected order, copies the data into the matrix, and rescales the pixel values from 12-bit depth ([0, 4095]) to 16-bit depth ([0, 65535]).
data | Pointer to the raw image buffer. The buffer must contain at least rows * cols * 2 bytes. The data is modified in-place to swap bytes for each pixel. |
rows | Number of image rows (height). |
cols | Number of image columns (width). |
cv::Mat
of type CV_16UC1 containing the image data with pixel values rescaled to 16 bits.Definition at line 68 of file opencv.cpp.