|
// SkewManager.h: interface for the SkewManager class.
//
//////////////////////////////////////////////////////////////////////
#ifndef __SKEWMANAGER_H__
#define __SKEWMANAGER_H__
#include "ImageData.h"
#define M_PI 3.14159265358979323846
class SkewManager
{
public:
SkewManager();
virtual ~SkewManager();
bool GetSkewAngle(bool isTextImage, ImageData& image, double& outAngle, int canny_slices = 0);
private:
enum EdgeType
{
ET_LEFT = 0,
ET_TOP,
ET_RIGHT,
ET_BOTTOM
};
struct SlopeInfo
{
double x;
double y;
double slope;
double rounded_slope;
int frequency;
SlopeInfo()
{
x = INFINITE;
y = INFINITE;
slope = INFINITE;
rounded_slope = INFINITE;
frequency = INFINITE;
}
};
bool IsText(ImageData& image);
double GetTextSkewAngle(ImageData& image, int sample_skip = 10);
double GetImageSkewAngle(ImageData& image, int slices, EdgeType edge_type, int edge_depth, double* indicator1, double* indicator2);
double Histogram(ImageData& image, double angle);
//DJP 07Feb13 Changed int row to unsigned int row to avoid compiler warning
unsigned int CastRay(ImageData& raster, unsigned int row, const double &dx, int dy);
unsigned int bit_count(unsigned char* buf, unsigned int start, unsigned int end);
double sqr(double x)
{
return x * x;
}
double m_skew;
int m_sample_skip;
// DJP 07Feb13 Changed int m_max_rows to unsigned int m_max_rows to avoid compiler warning
unsigned int m_max_rows;
unsigned int* m_rows;
};
#endif // __SKEWMANAGER_H__
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.