-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
inverting images for tesseract 4 #75
base: master
Are you sure you want to change the base?
Conversation
int size_r = width * height; | ||
unsigned char* image_rev = new unsigned char[size_r]; | ||
for (int i = 0; i < size_r; i++) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the bracket placement is inconsistent with the rest of the file
|
||
if (inverting_images) { | ||
int size_r = width * height; | ||
unsigned char* image_rev = new unsigned char[size_r]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You never free that pointer.
bool inverting_images = true; | ||
|
||
if (inverting_images) { | ||
int size_r = width * height; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be size_t. Probably size_t const
unsigned char* image_rev = new unsigned char[size_r]; | ||
for (int i = 0; i < size_r; i++) | ||
{ | ||
int val = static_cast<int>(image[i]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the cast?
I have zero experience with C. This seemed to have solved the problem I've had with tesseract 4. |
This contains the following PRs: - ruediger#72 by bit: Fix compile with gcc7 and tesseract 4 - ruediger#75 by oltodosel: inverting images for tesseract 4
This contains the following PRs: - ruediger#72 by @bit: Fix compile with gcc7 and tesseract 4 - ruediger#75 by @oltodosel: inverting images for tesseract 4
tesseract-ocr/tesseract#2417
https://github.com/tesseract-ocr/tesseract/wiki/ImproveQuality#inverting-images