20 #ifndef TESSERACT_CCMAIN_THRESHOLDER_H_ 21 #define TESSERACT_CCMAIN_THRESHOLDER_H_ 24 #include "publictypes.h" 55 void SetImage(
const unsigned char* imagedata,
int width,
int height,
56 int bytes_per_pixel,
int bytes_per_line);
60 void SetRectangle(
int left,
int top,
int width,
int height);
66 virtual void GetImageSizes(
int* left,
int* top,
int* width,
int* height,
67 int* imagewidth,
int* imageheight);
71 return pix_channels_ >= 3;
76 return pix_channels_ == 0;
94 return scale_ * yres_;
102 estimated_res_ = ppi;
107 return scale_ * estimated_res_;
115 void SetImage(
const Pix* pix);
121 virtual bool ThresholdToPix(
PageSegMode pageseg_mode, Pix** pix);
130 virtual Pix* GetPixRectThresholds();
143 virtual Pix* GetPixRectGrey();
154 return rect_left_ == 0 && rect_top_ == 0 &&
155 rect_width_ == image_width_ && rect_height_ == image_height_;
159 void OtsuThresholdRectToPix(Pix* src_pix, Pix** out_pix)
const;
165 void ThresholdRectToPix(Pix* src_pix,
int num_channels,
166 const int* thresholds,
const int* hi_values,
190 #endif // TESSERACT_CCMAIN_THRESHOLDER_H_ bool IsColor() const
Return true if the source image is color.
Definition: thresholder.h:70
bool IsBinary() const
Returns true if the source image is binary.
Definition: thresholder.h:75
void SetSourceYResolution(int ppi)
Definition: thresholder.h:86
int estimated_res_
Definition: thresholder.h:181
int GetScaledEstimatedResolution() const
Definition: thresholder.h:106
int image_width_
Definition: thresholder.h:174
int GetScaledYResolution() const
Definition: thresholder.h:93
int yres_
Definition: thresholder.h:180
int image_height_
Definition: thresholder.h:175
Definition: baseapi.cpp:94
int pix_wpl_
Definition: thresholder.h:177
int rect_top_
Definition: thresholder.h:183
int pix_channels_
Definition: thresholder.h:176
void SetEstimatedResolution(int ppi)
Definition: thresholder.h:101
int rect_height_
Definition: thresholder.h:185
int scale_
Definition: thresholder.h:179
int GetSourceYResolution() const
Definition: thresholder.h:90
bool IsFullImage() const
Return true if we are processing the full image.
Definition: thresholder.h:153
int rect_width_
Definition: thresholder.h:184
int GetScaleFactor() const
Definition: thresholder.h:79
int rect_left_
Definition: thresholder.h:182
Pix * pix_
Definition: thresholder.h:172
Definition: thresholder.h:36
PageSegMode
Definition: publictypes.h:163