Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

int size_r = width * height;
unsigned char* image_rev = new unsigned char[size_r];
for (int i = 0; i < size_r; i++)
{
Copy link
Owner

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];
Copy link
Owner

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;
Copy link
Owner

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]);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the cast?

@oltodosel
Copy link
Author

I have zero experience with C. This seemed to have solved the problem I've had with tesseract 4.

Geoffrey-A added a commit to Geoffrey-A/VobSub2SRT that referenced this pull request Jun 21, 2020
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
Geoffrey-A added a commit to Geoffrey-A/VobSub2SRT that referenced this pull request Jun 21, 2020
Geoffrey-A added a commit to Geoffrey-A/VobSub2SRT that referenced this pull request Jun 21, 2020
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
Geoffrey-A added a commit to Geoffrey-A/VobSub2SRT that referenced this pull request Jun 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants