win 图像旋转
This commit is contained in:
parent
abb58e4cb7
commit
a436d74482
|
@ -1,14 +1,14 @@
|
||||||
/*
|
/*
|
||||||
* ====================================================
|
* ====================================================
|
||||||
|
|
||||||
* 功能:旋转图像
|
* 功能:旋转图像
|
||||||
* 作者:刘丁维
|
* 作者:刘丁维
|
||||||
* 生成时间:2020/4/21
|
* 生成时间:2020/4/21
|
||||||
* 最近修改时间:v1.0 2020/04/21
|
* 最近修改时间:v1.0 2020/04/21
|
||||||
v1.1 2020/08/12 修复文稿方向自动识别导致崩溃的BUG
|
v1.1 2020/08/12 修复文稿方向自动识别导致崩溃的BUG
|
||||||
v1.2 2021/10/15 开放文稿方向识别模块
|
v1.2 2021/10/15 开放文稿方向识别模块
|
||||||
v1.2.1 2022/04/25 补充切换版本的预处理代码
|
v1.2.1 2022/04/25 补充切换版本的预处理代码
|
||||||
* 版本号:v1.2.1
|
* 版本号:v1.2.1
|
||||||
|
|
||||||
* ====================================================
|
* ====================================================
|
||||||
*/
|
*/
|
||||||
|
@ -31,21 +31,21 @@ class GIMGPROC_LIBRARY_API CImageApplyRotation : public CImageApply
|
||||||
public:
|
public:
|
||||||
enum class RotationType
|
enum class RotationType
|
||||||
{
|
{
|
||||||
Invalid, //无效
|
Invalid, //无效
|
||||||
Rotate_90_clockwise, //顺时针90°
|
Rotate_90_clockwise, //顺时针90°
|
||||||
Rotate_180, //180°
|
Rotate_180, //180°
|
||||||
Rotate_90_anti_clockwise, //逆时针90°,即270°
|
Rotate_90_anti_clockwise, //逆时针90°,即270°
|
||||||
|
|
||||||
AutoTextOrientation //自动文稿方向识别旋转
|
AutoTextOrientation //自动文稿方向识别旋转
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* rotation [in]:旋转类型
|
* rotation [in]:旋转类型
|
||||||
* isBackTransposed [in]:true为背面180°旋转,反之亦然
|
* isBackTransposed [in]:true为背面180°旋转,反之亦然
|
||||||
* dpi [in]:当前图像的DPI,该参数在rotation为AutoTextOrientation时生效。在识别文稿方向时,会默认将图像变换为200DPI进行识别
|
* dpi [in]:当前图像的DPI,该参数在rotation为AutoTextOrientation时生效。在识别文稿方向时,会默认将图像变换为200DPI进行识别
|
||||||
* tessadataPath [in]:训练库文件路径,该参数在rotation为AutoTextOrientation时生效
|
* tessadataPath [in]:训练库文件路径,该参数在rotation为AutoTextOrientation时生效
|
||||||
*/
|
*/
|
||||||
CImageApplyRotation(RotationType rotation, bool isBackTransposed = false, int dpi = 200, const char* tessdataPath = nullptr);
|
CImageApplyRotation(RotationType rotation, bool isBackTransposed = false, int dpi = 200, const char* tessdataPath = nullptr);
|
||||||
|
|
||||||
|
|
|
@ -620,18 +620,18 @@ namespace hg_imgproc
|
||||||
|
|
||||||
if (img_conf_.is_autotext)
|
if (img_conf_.is_autotext)
|
||||||
rotatetype = CImageApplyRotation::RotationType::AutoTextOrientation;
|
rotatetype = CImageApplyRotation::RotationType::AutoTextOrientation;
|
||||||
#if defined(WIN32) || defined(_WIN64)
|
/*#if defined(WIN32) || defined(_WIN64)
|
||||||
char szIniFile[MAX_PATH] = {0};
|
char szIniFile[MAX_PATH] = {0};
|
||||||
SHGetSpecialFolderPathA(NULL, szIniFile, CSIDL_WINDOWS, TRUE);
|
SHGetSpecialFolderPathA(NULL, szIniFile, CSIDL_WINDOWS, TRUE);
|
||||||
strcat(szIniFile, "\\twain_32\\HuaGoScan\\tessdata");
|
strcat(szIniFile, "\\twain_32\\HuaGoScan\\tessdata");
|
||||||
// m_iaList.push_back(shared_ptr<CImageApply>(new CImageApplyRotation(rotatetype, imgparams.BackRotate180, imgparams.DestResulution, szIniFile)));
|
// m_iaList.push_back(shared_ptr<CImageApply>(new CImageApplyRotation(rotatetype, imgparams.BackRotate180, imgparams.DestResulution, szIniFile)));
|
||||||
#else // WIN32
|
#else // WIN32*/
|
||||||
CImageApplyRotation Rotation(rotatetype,img_conf_.is_backrotate180,img_conf_.resolution_native,"./tessdata");
|
CImageApplyRotation Rotation(rotatetype,img_conf_.is_backrotate180,img_conf_.resolution_native,"./tessdata");
|
||||||
|
|
||||||
Rotation.apply(mats,img_conf_.is_duplex);
|
Rotation.apply(mats,img_conf_.is_duplex);
|
||||||
mats_ = mats;
|
mats_ = mats;
|
||||||
|
|
||||||
#endif
|
//#endif
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
//除网<E999A4>?
|
//除网<E999A4>?
|
||||||
|
|
Loading…
Reference in New Issue