43 lines
1.2 KiB
C++
43 lines
1.2 KiB
C++
|
// #include "Jpegcompress.h"
|
||
|
// #include <string>
|
||
|
|
||
|
// JpegCompress::JpegCompress(int quality):tjInstance(NULL)
|
||
|
// ,m_quality(quality)
|
||
|
// {
|
||
|
// }
|
||
|
|
||
|
// JpegCompress::~JpegCompress()
|
||
|
// {
|
||
|
// tjDestroy(tjInstance);
|
||
|
// }
|
||
|
|
||
|
// HG_JpegCompressInfo JpegCompress::GetCompressedImg(cv::Mat& mat)
|
||
|
// {
|
||
|
// HG_JpegCompressInfo info={0};
|
||
|
// if(mat.empty())
|
||
|
// {
|
||
|
// LOG("JpegCompress Empty Mat! warnning !!!!\n");
|
||
|
// return info;
|
||
|
// }
|
||
|
// tjInstance = tjInitCompress();
|
||
|
// int outSubsamp;
|
||
|
// int flags = 0;
|
||
|
// int pixelFormat;
|
||
|
// if (mat.channels() == 1)
|
||
|
// {
|
||
|
// outSubsamp = TJSAMP_GRAY;
|
||
|
// pixelFormat = TJPF_GRAY;
|
||
|
// }
|
||
|
// else
|
||
|
// {
|
||
|
// pixelFormat = TJPF_RGB;
|
||
|
// outSubsamp = TJSAMP_444;
|
||
|
// }
|
||
|
// //std::chrono::steady_clock::time_point _start = std::chrono::steady_clock::now();
|
||
|
// //LOG("image rows= %d cols= %d pixelFormat= %d \n",mat.rows,mat.cols,pixelFormat);
|
||
|
// tjCompress2(tjInstance, mat.data, mat.cols, 0, mat.rows, pixelFormat,
|
||
|
// &info.pJpegData, (long unsigned int*)&info.DataLength, outSubsamp, m_quality, flags);
|
||
|
|
||
|
// //LOG("jpeg compress done \n");
|
||
|
// return info;
|
||
|
// }
|