code_device/hgdriver/hgdev/image_process.cpp

903 lines
22 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "image_process.h"
#include "../../sdk/hginclude/hg_log.h"
#include <vector>
#include <string.h>
#ifndef WIN32
#include <unistd.h>
#else
#include <Windows.h>
#include <shlobj.h>
#pragma comment(lib, "Shell32.lib")
#endif
#include <memory>
#include "ImageMatQueue.h"
#include "../ImageProcess/ImageApplyHeaders.h"
#include "ImageMultiOutput.h"
#include "PaperSize.h"
#ifdef WIN32
#include "scanner_manager.h"
#endif
using namespace std;
#define GET_BYTE(a) ((a) & 0x0ff)
#define MAKE_INT(a, b, c, d) (GET_BYTE(a) | (GET_BYTE(b) << 8) | (GET_BYTE(c) << 16) | (GET_BYTE(d) << 24))
#define IMAGE_DATA_BUF_CVMAT (void*)MAKE_INT('M', 'T', 'R', 'X')
#define IMAGE_DATA_BUF_CHAR (void*)MAKE_INT('C', 'H', 'A', 'R')
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// functional ...
////////////////////////////////////////////////////////////////////////////////
// NEWflow ...
static int num=0;
namespace hg_imgproc
{
class imgproc
{
std::string my_path_;
IMGPRCPARAM param_;
SCANCONF img_conf_;
std::shared_ptr<std::string> raw_data_;
std::shared_ptr<vector<char>> buffer_;
std::vector<cv::Mat> mats_;
int pid_;
Device::PaperSize papersize_;
void swap_rgb(cv::Mat& mat)
{
unsigned char* first = (unsigned char*)mat.data,
* oper = first;
int line_bytes = mat.rows ? mat.total() * mat.channels() / mat.rows : mat.cols * mat.channels();
for (int i = 0; i < mat.rows; ++i)
{
oper = first;
for (int j = 0; j < mat.cols; ++j)
{
unsigned char ch = oper[0];
oper[0] = oper[2];
oper[2] = ch;
oper += 3;
}
first += line_bytes;
}
}
// construction
public:
imgproc(LPSCANCONF img_param,LPIMGPRCPARAM param,int pid) : img_conf_(*img_param),param_(*param),pid_(pid),papersize_(pid_)
{
my_path_ = hg_log::pe_path();
}
~imgproc()
{}
// load data
public:
int load_raw_data(std::shared_ptr<std::vector<char>> buff)
{
buffer_.reset(new std::vector<char >(*buff));
mats_.clear();
return HG_ERR_OK;
}
int load_file(const char* path_file)
{
mats_.clear();
FILE* src = fopen(path_file, "rb");
if (!src)
return HG_ERR_OPEN_FILE_FAILED;
long len = 0;
fseek(src, 0, SEEK_END);
len = ftell(src);
fseek(src, 0, SEEK_SET);
if (len > 1 * 1024 * 1024 * 1024)
{
fclose(src);
return HG_ERR_INSUFFICIENT_MEMORY;
}
raw_data_.reset(new std::string());
raw_data_->resize(len);
fread(&(*raw_data_)[0], 1, len, src);
fclose(src);
return HG_ERR_OK;
}
// image-processing
public:
int decode(int pid)
{
if (!buffer_)
return HG_ERR_NO_DATA;
size_t origin = buffer_->size();
std::vector<std::shared_ptr<std::vector<char>>> buffs;
if(pid == 0x100 || pid == 0x200)
buffs = G200Decode(buffer_,img_conf_.is_duplex,img_conf_.is_switchfrontback).getImageBuffs();
else if(pid == 0x139 || pid == 0x239)
buffs = GRawDecode(buffer_).getImageBuffs();
else if(pid == 0x300 || pid == 0x400)
buffs = G400Decode(buffer_,img_conf_.is_duplex).getImageBuffs();
if(buffs.empty())
return -1;
buffer_.reset();
for (auto& buf : buffs) {
cv::ImreadModes rmc = param_.channels > 1 ? cv::IMREAD_COLOR : cv::IMREAD_GRAYSCALE;
try
{
if (buf->at(0) == -119 && buf->at(1) == 0x50 && buf->at(2) == 0x4e && buf->at(3) == 0x47)
{
rmc = cv::IMREAD_GRAYSCALE;
param_.black_white = true;
}
else
param_.black_white = false;
if((pid == 0x100 || pid == 0x200 || pid == 0x300 || pid == 0x400)
&& (img_conf_.filter != 3
|| img_conf_.multiOutput == 1
|| img_conf_.multiOutput == 2
|| img_conf_.multiOutput == 0))
{
rmc = cv::IMREAD_COLOR;
}
cv::Mat mat(cv::imdecode(*buf, rmc));
//("/home/huagao/Desktop/1.jpg",mat);
if (mat.empty())
{
HG_LOG(HG_LOG_LEVEL_FATAL, "decode image data error\n");
continue;
}
if(pid == 0x100 || pid == 0x200 || pid == 0x139 || pid == 0x239)
{
mats_.push_back(mat);
}
else if(pid == 0x300 || pid == 0x400)
{
cv::Mat front = mat(cv::Rect(0, 0, mat.cols / 2, mat.rows));
cv::Mat back = mat(cv::Rect(mat.cols / 2, 0, mat.cols / 2, mat.rows));
if(img_conf_.is_duplex)
{
mats_.push_back(img_conf_.is_switchfrontback ? back :front);
mats_.push_back(img_conf_.is_switchfrontback ? front :back);
}
else
{
mats_.push_back(front);
}
back.release();
front.release();
}
buf.reset();
}
catch (const std::exception& e)
{
HG_LOG(HG_LOG_LEVEL_FATAL, e.what());
}
}
buffs.clear();
HG_VLOG_MINI_2(HG_LOG_LEVEL_DEBUG_INFO, "Decode %u bytes to %u picture(s)\n", origin, mats_.size());
if(mats_.size() == 0)
{
return HG_ERR_NO_DATA;
}
return HG_ERR_OK;
}
public:
int correct_text(void)
{
std::string sample(my_path_ + "/data/img/osd.traineddata");
CImageApplyRotation rot(CImageApplyRotation::RotationType::AutoTextOrientation, false, param_.dpi, sample.c_str());
rot.apply(mats_, img_conf_.is_duplex);
return HG_ERR_OK;
}
int split(int multioutputtype,bool is_msplit,bool is_multiout_red,int colortype,bool is_duplex)
{
std::vector<cv::Mat> mats(mats_);
CImageApplySplit split(multioutputtype, is_msplit, is_multiout_red, colortype);;
mats_.clear();
auto matexs = split.SplitMats(mats,is_duplex);
std::string filename ;
for(auto &matex : matexs)
{
cv::flip(matex.mat,matex.mat,0);
cv::flip(matex.mat,matex.mat,1);
if(!matex.mat.empty())
mats_.push_back(matex.mat);
}
return HG_ERR_OK;
}
int fadeback(int range,bool is_duplex)
{
std::vector<cv::Mat> mats(mats_);
mats_.clear();
CImageApplyFadeBackGroudColor fade(100,0,range);
for(size_t i = 0; i < mats.size();i++)
{
fade.apply(mats[i],img_conf_.is_duplex);
mats_.push_back(mats[i]);
// std::string filename = "/home/huagao/Desktop/fadeback("+std::to_string(num++)+").jpg";
// cv::imwrite(filename,mats_[i]);
// printf("fadeback.size :%d ,filename is =%s\r\n",mats_.size(),filename.c_str());
}
return HG_ERR_OK;
}
int multi_out(void)
{
std::vector<cv::Mat> mats(mats_);
mats_.clear();
for (size_t i = 0; i < mats.size(); ++i)
{
if (mats[i].empty())
continue;
vector<cv::Mat> retmats;
std::vector<std::shared_ptr<IMulti>> m_multiprc_list;
int multiout = 1,
colormode = 1;
//if (m_param.imageProcess.filter == ColorFilter::FILTER_NONE)
//{
// colormode = m_param.pixelType;
//}
if (param_.channels > 1)
m_multiprc_list.push_back(shared_ptr<IMulti>(new ImageMultiOutputRed(2)));
m_multiprc_list.push_back(shared_ptr<IMulti>(new IMageMulti(multiout)));
for (int j = 0; j < m_multiprc_list.size(); j++)
{
retmats = m_multiprc_list[j]->apply(mats[i]);
}
CImageApplySplit isp(multiout, false, 1, colormode);
if (!retmats.size())
{
std::vector<cv::Mat> matse;
matse.push_back(mats[i]);
auto matexs = isp.SplitMats(matse, img_conf_.is_duplex);
for (auto& matex : matexs)
{
mats_.push_back(matex.mat);
}
break;
}
else
{
auto matexs = isp.SplitMats(retmats, img_conf_.is_duplex);
for (auto& matex : matexs)
{
mats_.push_back(matex.mat);
}
}
}
return HG_ERR_OK;
}
int multi_out(int out_type)
{
std::vector<cv::Mat> mats(mats_);
mats_.clear();
IMageMulti output(out_type);
for(size_t i = 0;i < mats.size();i++)
{
output.apply(mats[i]);
mats_.push_back(mats[i]);
// std::string filename = "/home/huagao/Desktop/multi_out("+std::to_string(num++)+").jpg";
// cv::imwrite(filename,mats_[i]);
// printf("multi_out.size :%d ,multi_out is =%s\r\n",mats_.size(),filename.c_str());
}
return HG_ERR_OK;
}
int multi_out_red()
{
std::vector<cv::Mat> mats(mats_);
std::vector<cv::Mat> mat;
mats_.clear();
mat.clear();
ImageMultiOutputRed outred(2);
for(size_t i = 0;i < mats.size();i++)
{
mat = outred.apply(mats[i]);
for(size_t j = 0;j < mat.size();j++)
{
mats_.push_back(mat[j]);
}
// std::string filename = "/home/huagao/Desktop/multi_out_red("+std::to_string(num++)+").jpg";
// cv::imwrite(filename,mats_[i]);
// printf("fadeback.size :%d ,filename is =%s\r\n",mats_.size(),filename.c_str());
}
return HG_ERR_OK;
}
int auto_matic_color(int color_type)
{
int ret = HG_ERR_OK;
std::vector<cv::Mat> mats(mats_);
mats_.clear();
for(size_t i = 0;i < mats.size();i++)
{
CImageApplyColorRecognition ColorRecognition(color_type==1?
CImageApplyColorRecognition::ColorRecognitionMode::Color_Gray :
CImageApplyColorRecognition::ColorRecognitionMode::Color_Mono);
ColorRecognition.apply(mats[i],img_conf_.is_duplex);
mats_.push_back(mats[i]);
}
return ret;
}
/*pixtype 0 colcor; 1 gray; 2 bw*/
int auto_crop()
{
int ret = HG_ERR_OK;
std::vector<cv::Mat> mats(mats_);
mats_.clear();
SIZE temp_Size = papersize_.GetPaperSize(img_conf_.papertype,200,img_conf_.paperAlign);
cv::Size cvSize(temp_Size.cx, temp_Size.cy);
CImageApplyAutoCrop crop(img_conf_.is_autocrop,img_conf_.autodescrew,img_conf_.fillbackground,cvSize,true,img_conf_.isfillcolor);
crop.apply(mats,img_conf_.is_duplex);
mats_ = mats;
//cv::imwrite("/home/huagao/Desktop/mats_.jpg",mats_[0]);
return ret;
}
int fillhole()
{
int ret = HG_ERR_OK;
std::vector<cv::Mat> mats(mats_);
mats_.clear();
float scale = img_conf_.fillhole.fillholeratio / 100.0;
CImageApplyOutHole outh(200,scale,50);
outh.apply(mats,img_conf_.is_duplex);
mats_ = mats;
return ret;
}
int resolution_change()
{
int ret = HG_ERR_OK;
std::vector<cv::Mat> mats(mats_);
mats_.clear();
CImageApplyResize::ResizeType resizeType;
double ratio = 1.0;
SIZE reSize = papersize_.GetPaperSize(img_conf_.papertype, img_conf_.resolution_dst,img_conf_.paperAlign);
cv::Size cvSize(reSize.cx, reSize.cy);
if (img_conf_.is_autocrop || img_conf_.cropRect.enable)
{
resizeType = CImageApplyResize::ResizeType::RATIO;
ratio = img_conf_.resolution_dst / (float)img_conf_.resolution_native;
}
else
resizeType = CImageApplyResize::ResizeType::DSIZE;
CImageApplyResize resize(resizeType,cvSize,ratio,ratio);
resize.apply(mats,img_conf_.is_duplex);
if(!mats.empty())
mats_ = mats;
return ret;
}
int croprect()
{
int ret = HG_ERR_OK;
std::vector<cv::Mat> mats(mats_);
mats_.clear();
CImageApplyCustomCrop rect(cv::Rect(img_conf_.cropRect.x, img_conf_.cropRect.y, img_conf_.cropRect.width, img_conf_.cropRect.height));
for (size_t i = 0; i < mats.size(); ++i)
{
rect.apply(mats[i],img_conf_.is_duplex);
mats_.push_back(mats[i]);
}
return ret;
}
int channel()
{
int ret = HG_ERR_OK;
std::vector<cv::Mat> mats(mats_);
mats_.clear();
CImageApplyChannel chl((CImageApplyChannel::channel)(img_conf_.filter));
for (size_t i = 0; i < mats.size(); i++)
{
chl.apply(mats[i],img_conf_.is_duplex);
mats_.push_back(mats[i]);
}
return ret;
}
int customgamma(int is_customgamma)
{
int ret = HG_ERR_OK;
std::vector<cv::Mat> mats(mats_);
mats_.clear();
if(is_customgamma)
{
//CImageApplyCustomGamma gamme(); //暂留
}
else
{
if (img_conf_.brightness != 128 ||img_conf_.contrast != 4 || ((img_conf_.gamma < (1.0f - 1e-2)) || (img_conf_.gamma > (1.0f + 1e-2))) )
{
int temp_contrast = (img_conf_.contrast - 4) * 12;
CImageApplyAdjustColors justColors(img_conf_.brightness - 128, temp_contrast, img_conf_.gamma);
for (size_t i = 0; i < mats.size(); ++i)
{
justColors.apply(mats[i],img_conf_.is_duplex);
}
}
mats_ = mats;
//cv::imwrite("/home/huagao/Desktop/customgamma2.jpg",mats_[0]);
}
return ret;
}
//防止渗透
int antiInflow(int permeate_lv)
{
int ret = HG_ERR_OK;
std::vector<cv::Mat> mats(mats_);
mats_.clear();
CImageApplyRefuseInflow Inflow(permeate_lv);
for (size_t i = 0; i < mats.size(); ++i)
{
Inflow.apply(mats[i],img_conf_.is_duplex);
mats_.push_back(mats[i]);
}
return ret;
}
//色彩校正
int colorCorrection()
{
int ret = HG_ERR_OK;
std::vector<cv::Mat> mats(mats_);
mats_.clear();
CImageApplyAutoContrast con;
con.apply(mats,img_conf_.is_duplex);
mats_= mats;
return ret;
}
//图像旋转
int orentation()
{
int ret = HG_ERR_OK;
std::vector<cv::Mat> mats(mats_);
mats_.clear();
CImageApplyRotation::RotationType rotatetype = CImageApplyRotation::RotationType::Invalid;
switch ((CImageApplyRotation::RotationType)img_conf_.is_autotext)
{
case CImageApplyRotation::RotationType::Rotate_90_clockwise:
rotatetype = CImageApplyRotation::RotationType::Rotate_90_clockwise;
break;
case CImageApplyRotation::RotationType::Rotate_180:
rotatetype = CImageApplyRotation::RotationType::Rotate_180;
break;
case CImageApplyRotation::RotationType::Rotate_90_anti_clockwise:
rotatetype = CImageApplyRotation::RotationType::Rotate_90_anti_clockwise;
break;
default:
break;
}
if (img_conf_.is_autotext== TEXT_DIRECTION_AUTO)
rotatetype = CImageApplyRotation::RotationType::AutoTextOrientation;
#ifdef WIN32
char szIniFile[MAX_PATH] = {0};
SHGetSpecialFolderPathA(NULL, szIniFile, CSIDL_WINDOWS, TRUE);
strcat(szIniFile, "\\twain_32\\HuaGoScan\\tessdata");
// m_iaList.push_back(shared_ptr<CImageApply>(new CImageApplyRotation(rotatetype, imgparams.BackRotate180, imgparams.DestResulution, szIniFile)));
#else // WIN32
CImageApplyRotation Rotation(rotatetype,img_conf_.is_backrotate180,img_conf_.resolution_native,"./tessdata");
Rotation.apply(mats,img_conf_.is_duplex);
mats_ = mats;
#endif
return ret;
}
//除网纹
int textureRemove()
{
int ret = HG_ERR_OK;
std::vector<cv::Mat> mats(mats_);
mats_.clear();
CImageApplyTextureRemoval Removal;
Removal.apply(mats,img_conf_.is_duplex);
mats_ = mats;
return ret;
}
//锐化
int sharpenType()
{
int ret = HG_ERR_OK;
std::vector<cv::Mat> mats(mats_);
mats_.clear();
CImageApplyFilter::FilterMode sharpenType = (CImageApplyFilter::FilterMode)img_conf_.sharpen;
CImageApplyFilter Filte(sharpenType);
for (size_t i = 0; i < mats.size(); ++i)
{
Filte.apply(mats[i],img_conf_.is_duplex);
mats_.push_back(mats[i]);
}
return ret;
}
//黑白降噪
int nosieDetach()
{
int ret = HG_ERR_OK;
std::vector<cv::Mat> mats(mats_);
mats_.clear();
CImageApplyDetachNoise Noise(img_conf_.detachnoise.detachnoise);
for (size_t i = 0; i < mats.size(); ++i)
{
Noise.apply(mats[i],img_conf_.is_duplex);
mats_.push_back(mats[i]);
}
return ret;
}
//错误扩散
int errorextention()
{
int ret = HG_ERR_OK;
std::vector<cv::Mat> mats(mats_);
mats_.clear();
CImageApplyBWBinaray::ThresholdType thrtype;
if(img_conf_.errorExtention)
thrtype = CImageApplyBWBinaray::ThresholdType::ERROR_DIFFUSION;
else
thrtype = CImageApplyBWBinaray::ThresholdType::THRESH_BINARY;
CImageApplyBWBinaray BWBinaray(thrtype);
for (size_t i = 0; i < mats.size(); ++i)
{
BWBinaray.apply(mats[i],img_conf_.is_duplex);
mats_.push_back(mats[i]);
}
return ret;
}
int discardBlank()
{
int ret = HG_ERR_OK;
std::vector<cv::Mat> mats(mats_);
mats_.clear();
double threshold = 40; //默认值
int edge = 150;
CImageApplyDiscardBlank(threshold,edge,img_conf_.discardblank_percent);
for (size_t i = 0; i < mats.size(); ++i)
{
bool b = CImageApplyDiscardBlank::apply(mats[i]);
if (b)
mats[i].release();
else
mats_.push_back(mats[i]);
}
return ret;
}
//答题卡出红
int answerSheetFilterRed()
{
int ret = HG_ERR_OK;
std::vector<cv::Mat> mats(mats_);
mats_.clear();
CImageApplyHSVCorrect correct((CImageApplyHSVCorrect::Red_Removal));
for (size_t i = 0; i < mats.size(); ++i)
{
correct.apply(mats[i],img_conf_.is_duplex);
mats_.push_back(mats[i]);
}
return ret;
}
//对折
int fold()
{
int ret = HG_ERR_OK;
std::vector<cv::Mat> mats(mats_);
mats_.clear();
CImageApplyConcatenation fold(CImageApplyConcatenation::horizontal);
fold.apply(mats,img_conf_.is_duplex);
mats_= mats;
return ret;
}
// final
public:
int final(void)
{
std::vector<cv::Mat> mats(mats_);
mats_.clear();
for (size_t i = 0; i < mats.size(); ++i)
{
if (mats[i].empty())
continue;
int bpp = param_.black_white ? 8 : param_.bits * param_.channels;
MatEx out(mats[i], bpp);
if (out.mat.channels() == 3)
swap_rgb(out.mat);
mats_.push_back(out.mat);
}
return HG_ERR_OK;
}
int get_final_data(LPIMGHEAD pimh, void** buf, int index)
{
if ((index < 0 || index >= mats_.size()))
return HG_ERR_NO_DATA;
pimh->width = mats_[index].cols;
pimh->height = mats_[index].rows;
pimh->bits = 8; //mats_[index].depth
pimh->channels = mats_[index].channels();
pimh->total_bytes = mats_[index].total() * pimh->channels;
pimh->line_bytes = pimh->height ? pimh->total_bytes / pimh->height : pimh->width * pimh->channels;
*buf = mats_[index].data;
//cv::imwrite(to_string(index)+"_final.jpg",mats_[index]);
//printf("pimh->channels = %d \r\n",pimh->channels);
return HG_ERR_OK;
}
int get_final_data(LPIMGHEAD pimh, std::vector<unsigned char>* buf, int index)
{
if ((index < 0 || index >= mats_.size()))
return HG_ERR_NO_DATA;
pimh->width = mats_[index].cols;
pimh->height = mats_[index].rows;
pimh->bits = 8; //mats_[index].depth
pimh->channels = mats_[index].channels();
if((pimh->width * pimh->channels) % 4)
{
int len = pimh->width * pimh->channels;
pimh->line_bytes = (len + 3) / 4 * 4;
pimh->total_bytes = pimh->line_bytes * pimh->height;
buf->resize(pimh->total_bytes);
//printf("pimh->total_bytes=%d pimh->line_bytes=%d\r\n",pimh->total_bytes,pimh->line_bytes);
unsigned char* src = mats_[index].data, *dst = buf->data();
for(int i = 0; i < pimh->height; ++i)
{
memcpy(dst, src, len);
dst += pimh->line_bytes;
src += len;
}
}
else
{
pimh->total_bytes = mats_[index].total() * pimh->channels;
pimh->line_bytes = pimh->height ? pimh->total_bytes / pimh->height : pimh->width * pimh->channels;
buf->resize(pimh->total_bytes);
memcpy(buf->data(), mats_[index].data, pimh->total_bytes);
//cv::imwrite(to_string(index)+"_final.jpg",mats_[index]);
}
//printf("pimh->channels_01 = %d \r\n",pimh->channels);
return HG_ERR_OK;
}
int imgtypechange(std::string img_type_,void *buf,std::vector<unsigned char> &bmpdata)
{
int ret = HG_ERR_OK;
if(!buf)
{
return HG_ERR_NO_DATA;
}
cv::imencode(img_type_,*((cv::Mat*)buf),bmpdata);
return ret;
}
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// api ...
HIMGPRC init(LPSCANCONF parameter,LPIMGPRCPARAM param,int pid)
{
imgproc* obj = new imgproc(parameter,param,pid);
return (HIMGPRC)obj;
}
int load_buffer(HIMGPRC himg, std::shared_ptr<std::vector<char>> buff)
{
return ((imgproc*)himg)->load_raw_data(buff);
}
int load_file(HIMGPRC himg, const char* path_file)
{
return ((imgproc*)himg)->load_file(path_file);
}
int decode(HIMGPRC himg,int pid)
{
return ((imgproc*)himg)->decode(pid);
}
int correct_text(HIMGPRC himg)
{
return ((imgproc*)himg)->correct_text();
}
int split(HIMGPRC himg,int multioutputtype,bool is_msplit,bool is_multiout_red,int colortype,bool is_duplex)
{
return ((imgproc*)himg)->split( multioutputtype, is_msplit, is_multiout_red, colortype,is_duplex);
}
int fadeback(HIMGPRC himg,int range,bool is_duplex)
{
return ((imgproc*)himg)->fadeback(range,is_duplex);
}
int multi_out(HIMGPRC himg)
{
return ((imgproc*)himg)->multi_out();
}
int multi_out(HIMGPRC himg,int out_type)
{
return ((imgproc*)himg)->multi_out(out_type);
}
int multi_out_red(HIMGPRC himg)
{
return ((imgproc*)himg)->multi_out_red();
}
int auto_matic_color(HIMGPRC himg,int color_type)
{
return ((imgproc*)himg)->auto_matic_color(color_type);
}
int auto_crop(HIMGPRC himg)
{
return ((imgproc*)himg)->auto_crop();
}
int fillhole(HIMGPRC himg)
{
return ((imgproc*)himg)->fillhole();
}
int resolution_change(HIMGPRC himg)
{
return ((imgproc*)himg)->resolution_change();
}
int croprect(HIMGPRC himg)
{
return ((imgproc*)himg)->croprect();
}
int channel(HIMGPRC himg)
{
return ((imgproc*)himg)->channel();
}
int customgamma(HIMGPRC himg,int is_custogamma)
{
return ((imgproc*)himg)->customgamma(is_custogamma);
}
int antiInflow(HIMGPRC himg,int permeate_lv)
{
return ((imgproc*)himg)->antiInflow(permeate_lv);
}
int colorCorrection(HIMGPRC himg)
{
return ((imgproc*)himg)->colorCorrection();
}
int orentation(HIMGPRC himg)
{
return ((imgproc*)himg)->orentation();
}
int textureRemove(HIMGPRC himg)
{
return ((imgproc*)himg)->textureRemove();
}
int sharpenType(HIMGPRC himg)
{
return ((imgproc*)himg)->sharpenType();
}
int nosieDetach(HIMGPRC himg)
{
return ((imgproc*)himg)->nosieDetach();
}
int errorextention(HIMGPRC himg)
{
return ((imgproc*)himg)->errorextention();
}
int discardBlank(HIMGPRC himg)
{
return ((imgproc*)himg)->discardBlank();
}
int answerSheetFilterRed(HIMGPRC himg)
{
return ((imgproc*)himg)->answerSheetFilterRed();
}
//img_type_ = jpg png bmp
int imgtypechange(HIMGPRC himg,std::string img_type_,void *buf,std::vector<unsigned char> &bmpdata)
{
return ((imgproc*)himg)->imgtypechange(img_type_,buf,bmpdata);
}
int fold(HIMGPRC himg)
{
return ((imgproc*)himg)->fold();
}
int final(HIMGPRC himg)
{
return ((imgproc*)himg)->final();
}
int get_final_data(HIMGPRC himg, LPIMGHEAD pimh, void** buf, int index)
{
return ((imgproc*)himg)->get_final_data(pimh, buf, index);
}
int get_final_data(HIMGPRC himg, LPIMGHEAD pimh, std::vector<unsigned char>* buf, int index)
{
return ((imgproc*)himg)->get_final_data(pimh, buf, index);
}
void release(HIMGPRC himg)
{
imgproc* obj = (imgproc*)himg;
delete obj;
}
}