tesseract icon indicating copy to clipboard operation
tesseract copied to clipboard

Support image width and height larger than 32767

Open stweil opened this issue 3 years ago • 20 comments

Signed-off-by: Stefan Weil [email protected]

stweil avatar May 19 '21 15:05 stweil

Please don't merge until these changes were better tested.

stweil avatar May 19 '21 15:05 stweil

The modifications here allow processing of large images which fixes issue #3184. I only tested the example in that issue and did not run performance tests or measure the increased memory usage.

stweil avatar May 19 '21 15:05 stweil

Known issues: code setting x / y / width / height to INT16_MAX or -INT16_MAX needs modifications, too.

stweil avatar May 19 '21 15:05 stweil

Please don't merge until these changes were better tested.

This pull request is still a work in progress Draft pull requests cannot be merged.

amitdo avatar May 19 '21 15:05 amitdo

I wonder about the impact on regular size images.

How much more memory (in percents) will be consumed with this patch?

amitdo avatar May 19 '21 15:05 amitdo

How much more memory (in percents) will be consumed with this patch?

I don't have numbers up to now.

stweil avatar May 19 '21 16:05 stweil

This pull request introduces 3 alerts when merging eb8f13bea8adba3319413e78a6b67a8afb90b48b into 93348a83a324a479978d9dd399b34d15ec6c5d83 - view on LGTM.com

new alerts:

  • 3 for Comparison of narrow type with wide type in loop condition

lgtm-com[bot] avatar May 19 '21 16:05 lgtm-com[bot]

You changed int16->int32 a lot. That must be a typedef (using) for possible future changes?

egorpugin avatar Jun 28 '21 20:06 egorpugin

That must be a typedef (using) for possible future changes?

Yes, the current Tesseract code uses int16_t which I replaced by int32_t for image dimensions.

I considered using a typedef, but don't think that there will be a future change for which a typedef would help. What kind of possible change do you think of?

stweil avatar Jun 29 '21 05:06 stweil

What kind of possible change do you think of?

I agree, this may be subtle. But from programmer point of view seeing coord_t (or something like that) instead of just int32_t annotate code much better. You may note that in tess we have a lot of int vars which are hard to understand when navigating code here and there.

egorpugin avatar Jun 29 '21 07:06 egorpugin

But from programmer point of view seeing coord_t (or something like that) instead of just int32_t annotate code much better.

coord_t would violate the standards which reserve types ending with "_t". I now use TDimension.

stweil avatar Jul 25 '21 06:07 stweil

violate the standards

What standards?

egorpugin avatar Jul 25 '21 07:07 egorpugin

What standards?

ISO C, see https://www.gnu.org/software/libc/manual/html_node/Reserved-Names.html.

stweil avatar Jul 25 '21 07:07 stweil

Should we make support for large images an optional feature in release 5.0.0 by adding a configure option, for example --enable-large-images?

stweil avatar Sep 09 '21 20:09 stweil

Or just ignore them. If something big does not fit into 5.0.0 soon enough, just postpone.

egorpugin avatar Sep 09 '21 20:09 egorpugin

If you choose to do it for 5.0.0, I suggest to add to the help message that explains this option:

Experimental feature (use it only for testing purpose)

and in a comment in the code itself:

For package builders: We recommend not to enable this option because the feature is unstable/untested.

amitdo avatar Sep 09 '21 22:09 amitdo

Most parts of the initial pull requests are now in main, so support for larger images is prepared.

stweil avatar Oct 27 '21 07:10 stweil

@stweil Hi, Is this feat merged to main branched? Why i just see this not changed at the tag 5.3.0 source code : image

monotone avatar Feb 16 '23 06:02 monotone

No, it isn't merged. This pull request is still a draft.

stweil avatar Feb 16 '23 11:02 stweil

it seems some years already, what‘s the reason?

monotone avatar Feb 16 '23 12:02 monotone