twain3.0/huagao/G4Tiff.h

36 lines
597 B
C++

#pragma once
#include <opencv2/opencv.hpp>
#include <tiff.h>
#include <tiffio.h>
class G4Tiff
{
public:
enum class Mode
{
FileMode,
MemoryMode
};
G4Tiff(cv::Mat& mat, Mode mode, std::string path, int threshold=120,int res=200);
~G4Tiff();
public:
/*
*内存传输模式时压缩图像数据去数据
*/
void GetCompressedData(std::vector<uchar>& cmpeddata);
/*
* 文件模式时使用
*/
void SaveG4Tiff();
private:
void save(cv::Mat& mat);
private:
void except(bool condition, const std::string& message = "");
std::string m_tmppath;
int m_threshold;
int m_res;
Mode m_mode;
cv::Mat m_mat;
};