code_device/hgdriver/ImageProcess/ImageApplyRotation.h

83 lines
2.2 KiB
C
Raw Normal View History

2022-07-29 08:41:34 +00:00
/*
* ====================================================
2022-08-12 02:49:21 +00:00
*
*
* 2020/4/21
* v1.0 2020/04/21
v1.1 2020/08/12 稿BUG
v1.2 2021/10/15 稿
v1.2.1 2022/04/25
* v1.2.1
2022-07-29 08:41:34 +00:00
* ====================================================
*/
#ifndef IMAGE_APPLY_ROTATION_H
#define IMAGE_APPLY_ROTATION_H
#include "ImageApply.h"
#ifdef _WIN32
//#define USE_HANWANG
#ifdef USE_HANWANG
#define HG_GPDF_API_BUILD
#include <hg_gpdf.h>
#endif
#endif
class GIMGPROC_LIBRARY_API CImageApplyRotation : public CImageApply
{
public:
enum class RotationType
{
2022-08-12 02:49:21 +00:00
Invalid, //无效
Rotate_90_clockwise, //顺时针90°
Rotate_180, //180°
Rotate_90_anti_clockwise, //逆时针90°即270°
2022-07-29 08:41:34 +00:00
2022-08-12 02:49:21 +00:00
AutoTextOrientation //自动文稿方向识别旋转
2022-07-29 08:41:34 +00:00
};
public:
/*
2022-08-12 02:49:21 +00:00
* rotation [in]:
* isBackTransposed [in]:true为背面180°
* dpi [in]:DPIrotation为AutoTextOrientation时生效稿200DPI进行识别
* tessadataPath [in]:rotation为AutoTextOrientation时生效
2022-07-29 08:41:34 +00:00
*/
CImageApplyRotation(RotationType rotation, bool isBackTransposed = false, int dpi = 200, const char* tessdataPath = nullptr);
virtual ~CImageApplyRotation();
virtual void apply(cv::Mat& pDib, int side) override;
virtual void apply(std::vector<cv::Mat>& mats, bool isTwoSide);
bool isBackTransposed() { return m_backTranspose; }
int getDPI() { return m_dpi; }
RotationType getRotationType() { return m_rotation; }
void setBackTransposed(bool enabled) { m_backTranspose = enabled; }
void setDPI(int dpi) { m_dpi = dpi; }
void setRotationType(RotationType type) { m_rotation = type; }
private:
RotationType m_rotation;
bool m_backTranspose;
int m_dpi;
#ifdef _WIN32
#ifdef USE_HANWANG
HG_OCR* m_ocr;
#endif
#endif
};
#endif // !IMAGE_APPLY_ROTATION_H