42 lines
900 B
C++
42 lines
900 B
C++
#ifndef HUAGO_TIFF_H
|
|
#define HUAGO_TIFF_H
|
|
#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, int compression = COMPRESSION_CCITT_T6);
|
|
~G4Tiff();
|
|
|
|
static uchar* load_mini_file(const char* file, size_t* bytes, void* (*mem_alloc)(size_t, const char*));
|
|
|
|
public:
|
|
/*
|
|
*内存传输模式时压缩图像数据去数据
|
|
*/
|
|
void GetCompressedData(std::vector<uchar>& cmpeddata);
|
|
uchar* get_compressed_data(size_t* bytes, void* (*mem_alloc)(size_t, const char*));
|
|
/*
|
|
* 文件模式时使用
|
|
*/
|
|
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;
|
|
int compression_;
|
|
Mode m_mode;
|
|
cv::Mat m_mat;
|
|
};
|
|
#endif // !HUAGO_TIFF_H
|