扫描协议扩展

This commit is contained in:
masayume 2021-09-03 14:12:28 +08:00
parent 67d296fdc9
commit a9ae29134d
11 changed files with 289 additions and 74 deletions

View File

@ -85,7 +85,7 @@ BOOL CTwainUI::OnInitDialog()
UpdateUI();
UpdateListConfig();
dataChangeFunction();
//setvisable_size(false);
setvisable_size(false);
#ifdef G200
setvisable_sleepmode(false);
#endif // G200

View File

@ -246,7 +246,6 @@ void GScanO1003399::config_params(GScanCap& param)
cfg.g200params.enable_sizecheck = param.en_sizecheck == 1 ? 1 : 0;
cfg.g200params.unused_one = cfg.g200params.sizeerror_errorratio = 0;
param.resolution_dst >= 240.0f ? 1 : 0;
#else
@ -271,12 +270,12 @@ void GScanO1003399::config_params(GScanCap& param)
cfg.g400params.reversed1 = cfg.g400params.reversed2 = 0;
#endif // G200
config_scanparam(cfg);
config_imgprocparam({0});
config_imgprocparam({sizeof(GScanCap_3399)});
GScanCap_3399 param39{ 0 };
param39.AutoCrop_threshold = param.AutoCrop_threshold;
param39.autodescrew = param.autodescrew;
param39.automaticcolor = param.automaticcolor;
param39.automaticcolortype = param39.automaticcolortype;
param39.automaticcolortype = param.automaticcolortype;
param39.brightness = param.brightness;
param39.contrast = param.contrast;
param39.detachnoise = param.detachnoise;
@ -312,6 +311,8 @@ void GScanO1003399::config_params(GScanCap& param)
param39.scannum = param.scannum;
param39.sharpen = param.sharpen;
param39.threshold = param.threshold;
param39.multiOutput = MultiOutput::Unused;
param39.normalCrop = param.normalCrop;
m_usb->write_bulk(&param39, sizeof(param39));
}
@ -688,7 +689,7 @@ int GScanO1003399::read_data(void* data, int length, int timeout)
StopWatch sw;
FileTools::writelog(log_INFO, "read_data timeout =" + to_string(timeout));
while (readed < length) {
if (sw.elapsed_ms() < timeout)
if (sw.elapsed_ms() < timeout &&m_usb.get())
{
reading = std::max(0, std::min(length - readed, buffer_size));
reading = m_usb->read_bulk((unsigned char*)data + readed, reading);

View File

@ -439,6 +439,11 @@ void ImageMatQueue::proc()
while (bRun)
{
if (m_imagedata.Size() > 0)
{
this_thread::sleep_for(chrono::milliseconds(10));
continue;
}
string msg;
auto info = m_imgCacheinfo.Take();
if (info.path.length() == 0 || !isFileExist(info.path))
@ -571,10 +576,14 @@ void ImageMatQueue::proc()
mats[j].release();
break;
}
if (!mats[j].empty())
{
cv::Mat mergeOrgin_UV = ImageApplyUV::Apply(mats[j], uvmats[j], rects[j], isDesaskew, angleResults.size() > 0 ? angleResults[j] : 0, scanParam.pixtype);
if (!mergeOrgin_UV.empty())
mats[j] = mergeOrgin_UV;
}
}
rects.clear();
uvmats.clear();
}
#endif

View File

@ -146,7 +146,7 @@ typedef struct tagCONFIGINFO
typedef struct tagFillHole
{
byte is_fillhole;
uint8_t is_fillhole;
int fillholeratio;
}FillHole;
@ -181,6 +181,12 @@ typedef struct tagHARDWAREPARAMS
#endif
}HardwareCaps;
typedef struct tagSkew_Detection {
uint8_t enable;
int level;
}SkewDetection;
typedef struct Scan_Rect {
int width;
int height;
@ -188,7 +194,7 @@ typedef struct Scan_Rect {
int y;
}ScanRect;
enum PaperAlign :uint8_t {
enum PaperAlign :unsigned char {
Rot0 = 0,
Rot270 = 3,
AutoTextOrientation = 5
@ -259,6 +265,23 @@ struct GScanCap
std::string SavePath;
};
typedef struct tagCrop_Rect
{
int enable;
int x; /*****自定义裁切区域左上角x坐标*/
int y; /*****自定义裁切区域左上角y坐标*/
int width; /*****自定义裁切区域宽度*******/
int height; /*****自定义裁切区域高度*******/
}CropRect;
typedef enum tagMulti_Output {
Unused = -1,
All,
ColorGray,
ColorBw,
GrayBw
}MultiOutput;
struct GScanCap_3399
{
@ -302,6 +325,17 @@ struct GScanCap_3399
FillHole fillhole;
DetachNoise detachnoise; /**< 黑白降噪*/
uint8_t is_autotext; /**< 自动文本方向识别*/
bool isfillcolor; /**< 自动裁切颜色填充>*/
int refuseInflow; /**< 防止渗透>*/
int colorCorrection; /**< 色彩校正>*/
int removeMorr; /**< 去除摩尔纹>*/
int errorExtention; /** < 错误扩散>*/
int textureRemove; /** < 除网纹>*/
int splitImage; /** < 图像拆分>*/
CropRect cropRect; /**< 自定义裁切>*/
MultiOutput multiOutput; /**< 多流输出>*/
bool normalCrop; /**< 自动裁切深色样张>*/
uint32_t reserve[1024]; /**< 预留4096字节做协议扩展*/
};
typedef struct Paper_Status {

View File

@ -1,4 +1,4 @@
#include "ImageApplyAutoCrop.h"
#include "ImageApplyAutoCrop.h"
#include "ImageProcess_Public.h"
CImageApplyAutoCrop::CImageApplyAutoCrop()
@ -33,16 +33,88 @@ CImageApplyAutoCrop::~CImageApplyAutoCrop()
{
}
cv::Mat concatenateMatrix(const cv::Mat& first, const cv::Mat& second)
{
cv::Mat mul1 = cv::Mat::eye(3, 3, CV_64F);
cv::Mat mul2 = cv::Mat::eye(3, 3, CV_64F);
cv::Mat mul_r;
first.convertTo(mul_r, CV_64F);
mul_r.row(0).copyTo(mul1.row(0));
mul_r.row(1).copyTo(mul1.row(1));
second.convertTo(mul_r, CV_64F);
mul_r.row(0).copyTo(mul2.row(0));
mul_r.row(1).copyTo(mul2.row(1));
mul1 = mul2 * mul1;
mul_r = first.clone();
mul1.row(0).copyTo(mul_r.row(0));
mul1.row(1).copyTo(mul_r.row(1));
return mul_r;
}
std::vector<cv::Mat> comMat()
{
std::vector<cv::Mat> mats;
cv::Point2f srcTri[3];
srcTri[0] = cv::Point2f(1, 1);
srcTri[1] = cv::Point2f(1, 0);
srcTri[2] = cv::Point2f(0, 1);
const float fact = 0.1f;
float pos[] = { 0, 2 * fact, fact };
cv::Point2f dstTri[3];
dstTri[0] = cv::Point2f(1, 1);
dstTri[1] = cv::Point2f(1, 0.5);
dstTri[2] = cv::Point2f(0, 1);
for (int i = 0; i < 3; i++)
{
dstTri[0] = cv::Point2f(1, 1 + pos[i]);
dstTri[1] = cv::Point2f(1, pos[i]);
dstTri[2] = cv::Point2f(0, 1 + pos[i]);
mats.push_back(cv::getAffineTransform(srcTri, dstTri));
}
return mats;
}
void brightSharp(cv::Mat& src)
{
const float a = -0.49f;
const float b = 3.0f;
//float kernel_data[] = {
// a, 0, 0, 0, a,
// 0, 0, a, 0, 0,
// 0, a, b, a, 0,
// 0, 0, a, 0, 0,
// a, 0, 0, 0, a };
float kernel_data[] = {
0, a, 0,
a, b, a,
0, a, 0
};
cv::Mat kernel(3, 3, CV_32FC1, kernel_data);
cv::filter2D(src, src, src.depth(), kernel);
}
void CImageApplyAutoCrop::apply(cv::Mat& pDib, int side)
{
(void)side;
if (pDib.empty()) return;
if (!m_isCrop && !m_isDesaskew && !m_isFillBlank && m_normalCrop/* && m_fixedSize.empty()*/)
if (m_normalCrop)
{
pDib = pDib(cv::Rect((pDib.cols - m_fixedSize.width) / 2, side == 0 ? 75 : 145, m_fixedSize.width, m_fixedSize.height) & cv::Rect(0, 0, pDib.cols, pDib.rows)).clone();
cv::Rect roi = cv::Rect((pDib.cols - m_fixedSize.width) / 2, side == 0 ? 75 : 145, m_fixedSize.width, m_fixedSize.height) & cv::Rect(0, 0, pDib.cols, pDib.rows);
pDib = pDib(roi).clone();
m_rect = cv::RotatedRect(cv::Point2f(roi.x + roi.width / 2, roi.y + roi.height / 2), cv::Size2f(roi.width, roi.height), 0.0f);
return;
}
if (!m_isCrop && !m_isDesaskew && !m_isFillBlank && m_fixedSize.empty()) return;
cv::Mat src = pDib;
cv::Mat thre;
cv::Mat dst;
@ -62,7 +134,7 @@ void CImageApplyAutoCrop::apply(cv::Mat& pDib, int side)
if (m_maxContour.size() == 0)
{
thre.release();
//如果是固定幅面,须返回裁切后的尺寸
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǹ̶<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD><EFBFBD>к<EFBFBD>ijߴ<EFBFBD>
if (!m_isCrop)
pDib = pDib(cv::Rect((pDib.cols - m_fixedSize.width) / 2, (pDib.rows - m_fixedSize.height) / 2, m_fixedSize.width, m_fixedSize.height) & cv::Rect(0, 0, pDib.cols, pDib.rows)).clone();
#ifdef LOG
@ -75,7 +147,6 @@ void CImageApplyAutoCrop::apply(cv::Mat& pDib, int side)
cv::RotatedRect rect = hg::getBoundingRect(m_maxContour);
m_rect = rect;
cv::Rect boudingRect = cv::boundingRect(m_maxContour);
boudingRect.x -= 1;
boudingRect.y -= 1;
@ -84,30 +155,76 @@ void CImageApplyAutoCrop::apply(cv::Mat& pDib, int side)
if (m_isDesaskew && rect.angle != 0)
{
cv::Point2f srcTri[4];
cv::Point2f dstTri[3];
cv::Point2f srcTri[4], srcTri_temp[3], dstTri[3];
rect.points(srcTri);
for (cv::Point2f& p : srcTri)
{
p.x -= 0.5;
p.y -= 0.5;
}
dstTri[0] = cv::Point2f(0, rect.size.height - 1);
dstTri[1] = cv::Point2f(0, 0);
dstTri[2] = cv::Point2f(rect.size.width - 1, 0);
srcTri_temp[0] = dstTri[0];
srcTri_temp[1] = dstTri[1];
srcTri_temp[2] = dstTri[2];
cv::Mat warp_mat;
warp_mat = cv::getAffineTransform(srcTri, dstTri);
if (src.channels() == 1)
{
cv::warpAffine(src, dst, warp_mat, rect.size, cv::INTER_LINEAR);
}
else
dst = src(boudingRect & cv::Rect(0, 0, src.cols, src.rows));
{
cv::Mat bgr[3];
cv::split(src, bgr);
auto mats = comMat();
warp_mat = cv::getAffineTransform(srcTri, dstTri);
warp_mat = concatenateMatrix(mats[0], warp_mat);
//warp_mat = mats[0];
m_maxContour.clear();
m_maxContour.push_back(cv::Point(-1, dst.rows));
m_maxContour.push_back(cv::Point(-1, -1));
m_maxContour.push_back(cv::Point(dst.cols, -1));
m_maxContour.push_back(cv::Point(dst.cols, dst.rows));
cv::warpAffine(bgr[0], bgr[0], warp_mat, rect.size, cv::INTER_LINEAR);
warp_mat = cv::getAffineTransform(srcTri, dstTri);
warp_mat = concatenateMatrix(mats[1], warp_mat);
//warp_mat = mats[1];
cv::warpAffine(bgr[1], bgr[1], warp_mat, rect.size, cv::INTER_LINEAR);
warp_mat = cv::getAffineTransform(srcTri, dstTri);
warp_mat = concatenateMatrix(mats[2], warp_mat);
//warp_mat = mats[2];
cv::warpAffine(bgr[2], bgr[2], warp_mat, rect.size, cv::INTER_LINEAR);
cv::merge(bgr, 3, dst);
}
double* ptr_m = reinterpret_cast<double*>(warp_mat.data);
double a = ptr_m[0];
double b = ptr_m[1];
double c = ptr_m[2];
double d = ptr_m[3];
double e = ptr_m[4];
double f = ptr_m[5];
for (cv::Point& p : m_maxContour)
{
p.x = static_cast<int>(a * p.x + b * p.y + c);
p.y = static_cast<int>(d * p.x + e * p.y + f);
}
}
else
{
auto t_rect = boudingRect & cv::Rect(0, 0, src.cols, src.rows);
dst = src(t_rect);
if (dst.channels() == 3)
{
cv::Mat bgr[3];
cv::split(dst, bgr);
auto mats = comMat();
for (int i = 0; i < 3; i++)
{
cv::warpAffine(bgr[i], bgr[i], mats[i], t_rect.size(), cv::INTER_LINEAR);
}
cv::merge(bgr, 3, dst);
}
}
cv::Scalar autoBGColor;
@ -118,21 +235,31 @@ void CImageApplyAutoCrop::apply(cv::Mat& pDib, int side)
if (m_indent > 0)
{
std::vector<cv::Point> rectEdge{ cv::Point(0, 0) ,cv::Point(thre_dst.cols - 1, 0),
cv::Point(thre_dst.cols - 1, thre_dst.rows - 1), cv::Point(0, thre_dst.rows - 1) };
std::vector<std::vector<cv::Point>> rectEdges{ rectEdge };
cv::drawContours(thre_dst, rectEdges, 0, cv::Scalar::all(0));
cv::Mat element = cv::getStructuringElement(cv::MorphShapes::MORPH_RECT, cv::Size(m_indent, m_indent));
cv::erode(thre_dst, thre_dst, element, cv::Point(-1, -1), 1);
for (size_t i = 0, length = m_maxContour.size() - 1; i < length; i++)
cv::line(thre_dst, m_maxContour[i], m_maxContour[i + 1], cv::Scalar::all(0), m_indent * 2);
cv::line(thre_dst, *m_maxContour.begin(), *m_maxContour.rbegin(), cv::Scalar::all(0), m_indent * 2);
}
//cv::imwrite("abc.jpg", thre_dst);
hierarchy.clear();
contours.clear();
m_maxContour.clear();
hg::findContours(thre_dst, contours, hierarchy, cv::RETR_EXTERNAL);
if (m_isConvexHull)
{
m_maxContour = hg::getMaxContour(contours, hierarchy);
if (m_maxContour.size() == 0)
{
thre.release();
//<2F><><EFBFBD><EFBFBD>ǹ̶<C7B9><CCB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD><D8B2>к<EFBFBD>ijߴ<C4B3>
if (!m_isCrop)
pDib = pDib(cv::Rect((pDib.cols - m_fixedSize.width) / 2, (pDib.rows - m_fixedSize.height) / 2, m_fixedSize.width, m_fixedSize.height) & cv::Rect(0, 0, pDib.cols, pDib.rows)).clone();
#ifdef LOG
FileTools::write_log("imgprc.txt", "exit CImageApplyAutoCrop apply");
#endif // LOG
return;
}
hg::convexHull(m_maxContour, m_maxContour);
contours.clear();
contours.push_back(m_maxContour);
@ -147,6 +274,14 @@ void CImageApplyAutoCrop::apply(cv::Mat& pDib, int side)
autoBGColor = m_isFillColor ? getBackGroudColor(pDib, rect.size.area()) : cv::Scalar(255, 255, 255);
hg::fillPolys(dst, contours, autoBGColor);
}
else
{
m_maxContour.clear();
m_maxContour.push_back(cv::Point(-1, dst.rows));
m_maxContour.push_back(cv::Point(-1, -1));
m_maxContour.push_back(cv::Point(dst.cols, -1));
m_maxContour.push_back(cv::Point(dst.cols, dst.rows));
}
pDib.release();
if (/*(m_isCrop && side == 0) || (side == 1 && m_fixedSize.width * m_fixedSize.height == 0)*/ m_isCrop)
@ -166,16 +301,20 @@ void CImageApplyAutoCrop::apply(cv::Mat& pDib, int side)
p += roi.tl();
dst(roi).copyTo(pDib(rect));
}
#ifdef LOG
FileTools::write_log("imgprc.txt", "exit CImageApplyAutoCrop apply8");
#endif // LOG
}
void CImageApplyAutoCrop::apply(std::vector<cv::Mat>& mats, bool isTwoSide)
{
m_rects.clear();
if (mats.empty()) return;
if (!mats[0].empty()) {
apply(mats[0], 0);
m_rects.push_back(m_rect);
//cv::imwrite("1.bmp", mats[0]);
brightSharp(mats[0]);
}
if (isTwoSide && mats.size() > 1)
@ -186,6 +325,7 @@ void CImageApplyAutoCrop::apply(std::vector<cv::Mat>& mats, bool isTwoSide)
if (!mats[1].empty()) {
apply(mats[1], 1);
m_rects.push_back(m_rect);
brightSharp(mats[1]);
}
if (!mats[0].empty())

View File

@ -55,7 +55,8 @@ void ImageApplyUV::Apply(cv::Mat& image, const cv::Mat& uv, int dpi, int thresh)
cv::Mat ImageApplyUV::Apply(const cv::Mat& image, const cv::Mat& uv, const cv::RotatedRect& uvRoi, bool isDesaskew, int angle, int pixtype)
{
static int svindex = 0;
if (uvRoi.size.width == 0) return cv::Mat();
if (uvRoi.size.width == 0)
return cv::Mat();
cv::RotatedRect uvRoi_clone = uvRoi;
cv::Mat dst = cv::Mat::zeros(image.rows > image.cols ? image.rows : (image.rows * 2), image.cols > image.rows ? image.cols : (image.cols * 2), image.type());
image.copyTo(dst(cv::Rect(0, 0, image.cols, image.rows)));
@ -70,54 +71,76 @@ cv::Mat ImageApplyUV::Apply(const cv::Mat& image, const cv::Mat& uv, const cv::R
if (angle == 90)
{
dstTri[0] = cv::Point2f(0, 0);
dstTri[1] = cv::Point2f(dst_uv.cols - 1, 0);
dstTri[2] = cv::Point2f(dst_uv.cols - 1, dst_uv.rows - 1);
dstTri[1] = cv::Point2f(uvRoi_clone.size.width - 1, 0);
dstTri[2] = cv::Point2f(uvRoi_clone.size.width - 1, uvRoi_clone.size.height - 1);
}
else if (angle == 180)
{
dstTri[0] = cv::Point2f(dst_uv.cols - 1, 0);
dstTri[1] = cv::Point2f(dst_uv.cols - 1, dst_uv.rows - 1);
dstTri[2] = cv::Point2f(0, dst_uv.rows - 1);
dstTri[0] = cv::Point2f(uvRoi_clone.size.width - 1, 0);
dstTri[1] = cv::Point2f(uvRoi_clone.size.width - 1, uvRoi_clone.size.height - 1);
dstTri[2] = cv::Point2f(0, uvRoi_clone.size.height - 1);
}
else if (angle == 270)
{
dstTri[0] = cv::Point2f(dst_uv.cols - 1, dst_uv.rows - 1);
dstTri[1] = cv::Point2f(0, dst_uv.rows - 1);
dstTri[0] = cv::Point2f(uvRoi_clone.size.width - 1, uvRoi_clone.size.height - 1);
dstTri[1] = cv::Point2f(0, uvRoi_clone.size.height - 1);
dstTri[2] = cv::Point2f(0, 0);
}
else
{
dstTri[0] = cv::Point2f(0, dst_uv.rows - 1);
dstTri[0] = cv::Point2f(0, uvRoi_clone.size.height - 1);
dstTri[1] = cv::Point2f(0, 0);
dstTri[2] = cv::Point2f(dst_uv.cols - 1, 0);
dstTri[2] = cv::Point2f(uvRoi_clone.size.width - 1, 0);
}
cv::Mat warp_mat = cv::getAffineTransform(srcTri, dstTri);
if (uv.channels() == 1 && dst_uv.channels() == 3)
{
cv::Mat uv_temp;
cv::warpAffine(uv, uv_temp, warp_mat, dst_uv.size());
cv::cvtColor(uv_temp, dst_uv, cv::COLOR_GRAY2BGR);
}
else
{
//imwrite("D:\\bfuv" + std::to_string(++svindex) + ".jpg", uv);
cv::Mat matuv;
if (image.channels() == 1 && uv.channels() == 3)
{
cvtColor(uv, matuv, COLOR_BGR2GRAY);
cv::warpAffine(uv, uv_temp, warp_mat, cv::Size(uvRoi_clone.size.width, uvRoi_clone.size.height));
//cv::imwrite("uv_temp.jpg", uv_temp);
if (pixtype == 0)//śţ־͟
cv::threshold(matuv, matuv, 150, 255, THRESH_OTSU);
}
else
{
matuv = uv;
cvtColor(uv_temp, uv_temp, cv::COLOR_BGR2GRAY);
cv::threshold(uv_temp, uv_temp, 150, 255, THRESH_OTSU);
}
cv::warpAffine(matuv, dst_uv, warp_mat, dst_uv.size());
//dst_uv.copyTo(dst(cv::Rect(image.rows > image.cols ? image.cols : 0, image.rows > image.cols ? 0 : image.rows, dst_uv.cols, dst_uv.rows)));
//dst_uv.copyTo(dst(cv::Rect(image.rows > image.cols ? image.cols : 0, image.rows > image.cols ? 0 : image.rows, image.cols, image.rows)));
//imwrite("D:\\aftuv" + std::to_string(svindex) + ".jpg", dst_uv);
if (uv_temp.channels() == 1 && dst_uv.channels() == 3)
{
cv::cvtColor(uv_temp(cv::Rect(
uv_temp.cols > dst_uv.cols ? (uv_temp.cols - dst_uv.cols) / 2 : 0,
uv_temp.rows > dst_uv.rows ? (uv_temp.rows - dst_uv.rows) / 2 : 0,
uv_temp.cols > dst_uv.cols ? dst_uv.cols : uv_temp.cols,
uv_temp.rows > dst_uv.rows ? dst_uv.rows : uv_temp.rows)),
dst_uv(cv::Rect(
dst_uv.cols > uv_temp.cols ? (dst_uv.cols - uv_temp.cols) / 2 : 0,
dst_uv.rows > uv_temp.rows ? (dst_uv.rows - uv_temp.rows) / 2 : 0,
dst_uv.cols > uv_temp.cols ? uv_temp.cols : dst_uv.cols,
dst_uv.rows > uv_temp.rows ? uv_temp.rows : dst_uv.rows)), cv::COLOR_GRAY2BGR);
}
else if (uv_temp.channels() == 3 && dst_uv.channels() == 1)
{
cv::cvtColor(uv_temp(cv::Rect(
uv_temp.cols > dst_uv.cols ? (uv_temp.cols - dst_uv.cols) / 2 : 0,
uv_temp.rows > dst_uv.rows ? (uv_temp.rows - dst_uv.rows) / 2 : 0,
uv_temp.cols > dst_uv.cols ? dst_uv.cols : uv_temp.cols,
uv_temp.rows > dst_uv.rows ? dst_uv.rows : uv_temp.rows)),
dst_uv(cv::Rect(
dst_uv.cols > uv_temp.cols ? (dst_uv.cols - uv_temp.cols) / 2 : 0,
dst_uv.rows > uv_temp.rows ? (dst_uv.rows - uv_temp.rows) / 2 : 0,
dst_uv.cols > uv_temp.cols ? uv_temp.cols : dst_uv.cols,
dst_uv.rows > uv_temp.rows ? uv_temp.rows : dst_uv.rows)), cv::COLOR_BGR2GRAY);
}
else
{
uv_temp(cv::Rect(
uv_temp.cols > dst_uv.cols ? (uv_temp.cols - dst_uv.cols) / 2 : 0,
uv_temp.rows > dst_uv.rows ? (uv_temp.rows - dst_uv.rows) / 2 : 0,
uv_temp.cols > dst_uv.cols ? dst_uv.cols : uv_temp.cols,
uv_temp.rows > dst_uv.rows ? dst_uv.rows : uv_temp.rows)).copyTo(dst_uv(cv::Rect(
dst_uv.cols > uv_temp.cols ? (dst_uv.cols - uv_temp.cols) / 2 : 0,
dst_uv.rows > uv_temp.rows ? (dst_uv.rows - uv_temp.rows) / 2 : 0,
dst_uv.cols > uv_temp.cols ? uv_temp.cols : dst_uv.cols,
dst_uv.rows > uv_temp.rows ? uv_temp.rows : dst_uv.rows)));
}
}

View File

@ -204,6 +204,14 @@ namespace hg
rect.size.height = temp;
}
if (rect.angle > 45)
{
rect.angle -= 90;
float temp = rect.size.width;
rect.size.width = rect.size.height;
rect.size.height = temp;
}
return rect;
}

View File

@ -86,7 +86,7 @@ using namespace std::placeholders;
TWPP_ENTRY_MFC(HuagaoDs)
static constexpr const Identity srcIdent(
Version(3, 3, Language::English, Country::China, "v3.3.5.1"),
Version(3, 3, Language::English, Country::China, "v3.3.5.4"),
DataGroup::Image,
#ifdef MAKEHUAGAO
"HUAGO",

Binary file not shown.

Binary file not shown.