2020-03-11 01:58:06 +00:00
|
|
|
#ifndef IMAGE_APPLY_ROTATION_H
|
|
|
|
#define IMAGE_APPLY_ROTATION_H
|
|
|
|
|
|
|
|
#include "ImageApply.h"
|
|
|
|
|
2020-04-18 03:18:06 +00:00
|
|
|
class CImageApplyRotation : public CImageApply
|
2020-03-11 01:58:06 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum class RotationType
|
|
|
|
{
|
2021-06-30 13:58:13 +00:00
|
|
|
Invalid,
|
|
|
|
Rotate_90_clockwise,
|
|
|
|
Rotate_180,
|
|
|
|
Rotate_90_anti_clockwise,
|
2020-03-11 01:58:06 +00:00
|
|
|
|
2021-06-30 13:58:13 +00:00
|
|
|
AutoTextOrientation
|
2020-03-11 01:58:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
CImageApplyRotation(RotationType rotation, bool isBackTransposed = false, int dpi = 200, const char* tessdataPath = nullptr);
|
|
|
|
|
|
|
|
virtual ~CImageApplyRotation();
|
|
|
|
|
2021-06-30 13:58:13 +00:00
|
|
|
virtual void apply(cv::Mat& pDib, int side) override;
|
2020-03-11 01:58:06 +00:00
|
|
|
|
|
|
|
virtual void apply(std::vector<cv::Mat>& mats, bool isTwoSide);
|
|
|
|
|
|
|
|
bool isBackTransposed() { return m_backTranspose; }
|
|
|
|
|
|
|
|
int getDPI() { return m_dpi; }
|
|
|
|
|
2021-06-30 13:58:13 +00:00
|
|
|
int angleResult() { return m_angleResult; }
|
|
|
|
|
|
|
|
const std::vector<int>& angleResults() { return m_angleResults; }
|
|
|
|
|
2020-03-11 01:58:06 +00:00
|
|
|
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;
|
|
|
|
|
|
|
|
void* osd;
|
2021-06-30 13:58:13 +00:00
|
|
|
|
|
|
|
int m_angleResult;
|
|
|
|
std::vector<int> m_angleResults;
|
2020-03-11 01:58:06 +00:00
|
|
|
};
|
|
|
|
|
2020-04-18 03:18:06 +00:00
|
|
|
#endif // !IMAGE_APPLY_ROTATION_H
|