Skip to content

Commit

Permalink
Fixed BestPix to always return the highest resolution available, even…
Browse files Browse the repository at this point in the history
… if a lower bit depth than the original
  • Loading branch information
theraysmith committed Jul 19, 2017
1 parent 66e686a commit cec1037
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions ccmain/tesseractclass.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,22 @@ class Tesseract : public Wordrec {
sub_langs_[i]->set_pix_original(original_pix ? pixClone(original_pix)
: nullptr);
}
// Returns a pointer to a Pix representing the best available (original) image
// of the page. Can be of any bit depth, but never color-mapped, as that has
// always been dealt with. Note that in grey and color, 0 is black and 255 is
// Returns a pointer to a Pix representing the best available resolution image
// of the page, with best available bit depth as second priority. Result can
// be of any bit depth, but never color-mapped, as that has always been
// removed. Note that in grey and color, 0 is black and 255 is
// white. If the input was binary, then black is 1 and white is 0.
// To tell the difference pixGetDepth() will return 32, 8 or 1.
// In any case, the return value is a borrowed Pix, and should not be
// deleted or pixDestroyed.
Pix* BestPix() const { return pix_original_; }
Pix* BestPix() const {
if (pixGetWidth(pix_original_) == ImageWidth())
return pix_original_;
else if (pix_grey_ != NULL)
return pix_grey_;
else
return pix_binary_;
}
void set_pix_thresholds(Pix* thresholds) {
pixDestroy(&pix_thresholds_);
pix_thresholds_ = thresholds;
Expand Down

0 comments on commit cec1037

Please sign in to comment.