19#ifndef TESSERACT_CCMAIN_THRESHOLDER_H_
20#define TESSERACT_CCMAIN_THRESHOLDER_H_
64 void SetImage(
const unsigned char *imagedata,
int width,
int height,
int bytes_per_pixel,
69 void SetRectangle(
int left,
int top,
int width,
int height);
75 virtual void GetImageSizes(
int *left,
int *top,
int *width,
int *height,
int *imagewidth,
80 return pix_channels_ >= 3;
85 return pix_channels_ == 0;
103 return scale_ * yres_;
111 estimated_res_ = ppi;
116 return scale_ * estimated_res_;
124 void SetImage(
const Image pix);
130 virtual bool ThresholdToPix(
Image *pix);
132 virtual std::tuple<bool, Image, Image, Image> Threshold(
TessBaseAPI *api,
142 virtual Image GetPixRectThresholds();
155 virtual Image GetPixRectGrey();
166 return rect_left_ == 0 && rect_top_ == 0 && rect_width_ == image_width_ &&
167 rect_height_ == image_height_;
171 void OtsuThresholdRectToPix(
Image src_pix,
Image *out_pix)
const;
177 void ThresholdRectToPix(
Image src_pix,
int num_channels,
const std::vector<int> &thresholds,
178 const std::vector <int> &hi_values,
Image *pix)
const;
struct TessBaseAPI TessBaseAPI
int GetScaledEstimatedResolution() const
int pix_wpl_
Words per line of pix_.
void SetEstimatedResolution(int ppi)
int GetSourceYResolution() const
bool IsFullImage() const
Return true if we are processing the full image.
bool IsColor() const
Return true if the source image is color.
int estimated_res_
Resolution estimate from text size.
int GetScaledYResolution() const
int scale_
Scale factor from original image.
int pix_channels_
Number of 8-bit channels in pix_.
int yres_
y pixels/inch in source image.
int image_width_
Width of source pix_.
int GetScaleFactor() const
bool IsBinary() const
Returns true if the source image is binary.
int image_height_
Height of source pix_.
void SetSourceYResolution(int ppi)