#pragma once #include "Common.h" enum ImreadModes { Unchanged = -1, Grayscale = 0, Color = 1, AnyDepth = 2, AnyColor = 4, LoadGdal = 8, }; enum ImwriteFlags { JpegQuality, JpegProgressive, JpegOptimize, JpegRstInterval, JpegLumaQuality, JpegChromaQuality, PngCompression, PngStrategy, PngBilevel, }; typedef struct { ImwriteFlags flagName; int flagValue; }ImwriteParam; enum ImwriteExtension { Png, Jpg, Bmp, }; class EncodeDecodeHelper { public: EncodeDecodeHelper(); ~EncodeDecodeHelper(); bool Encode(ImageInfo srcImgInfo,ImwriteExtension extension, ImwriteParam* imwriteParams, int paramCount,uint8_t* dstImgData, int& dstDataSize); bool Decode(const uint8_t* srcImgData, const int srcDataSize, uint8_t* dstImgData, const int dstDataSize, ImreadModes readMode); bool SaveImage(ImageInfo srcImgInfo, ImwriteExtension extension, ImwriteParam* imwriteParams, int paramCount, const char* savePath); private: cv::Mat _imgDecode; cv::Mat _imgEncode; std::vector _dataEncode; std::vector _dataDecode; };