12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- #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<uchar> _dataEncode;
- std::vector<uchar> _dataDecode;
- };
|