Support BMP and JPG conversion

This commit is contained in:
2026-04-13 14:12:47 +10:00
parent 3a4320f253
commit 56a8f09adf
2 changed files with 288 additions and 0 deletions

View File

@@ -178,5 +178,15 @@ typedef LVArray2D_U32** LVArray2D_U32Hdl;
extern "C" __declspec(dllexport) int ANSCV_ImageToArray(cv::Mat** imageIn, LVArray2D_U32Hdl arrayOut);
// cv::Mat -> IMAQ via LStrHandle (lossless PNG)
extern "C" __declspec(dllexport) int ANSCV_Image2IMAQ(cv::Mat** imageIn, LStrHandle outputImage);
// cv::Mat -> 1D U8 array (raw BGR pixels, row-major) + width, height, channels
typedef struct { int32 dimSizes[1]; uInt8 elt[1]; } LVArray1D_U8;
typedef LVArray1D_U8** LVArray1D_U8Hdl;
extern "C" __declspec(dllexport) int ANSCV_ImageToFlatArray(cv::Mat** imageIn, LVArray1D_U8Hdl arrayOut, int* width, int* height, int* channels);
// 1D U8 raw pixel array -> JPEG string
extern "C" __declspec(dllexport) int ANSCV_FlatArrayToJpeg(LVArray1D_U8Hdl arrayIn, int width, int height, int channels, int quality, LStrHandle outputImage);
// cv::Mat -> BMP binary string (no compression, fastest possible, for .NET Image.FromStream)
extern "C" __declspec(dllexport) int ANSCV_ImageToBmp(cv::Mat** imageIn, int maxWidth, int& newWidth, int& newHeight, LStrHandle outputImage);
// BMP string -> JPEG string (for storage/network)
extern "C" __declspec(dllexport) int ANSCV_BmpToJpeg(LStrHandle bmpInput, int quality, LStrHandle jpegOutput);
#endif