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

Binarizer performance improvements #115

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

danimoh
Copy link

@danimoh danimoh commented Feb 15, 2019

Hi Cosmo.
I noticed that in the binarizer new buffers are assigned for the grayscale image and binary image(s).
However, these buffers can be assigned within the rgba image buffer, as this data is not needed anymore after conversion to grayscale / binarization.
This saves allocation and garbage collection of up to 3 * pixelCount + blackPointsCount bytes.
According to my tests, this makes the code 20%-30% faster.

(Sorry for the force-pushs. I couldn't run the tests locally and therefore had to rely on travis for testing.)

@danimoh danimoh force-pushed the daniel/binarizer-performance-improvements branch 3 times, most recently from 4a4f2a9 to fddc609 Compare February 15, 2019 21:34
@danimoh
Copy link
Author

danimoh commented Feb 16, 2019

I just noticed, that a canOverwriteImage value of false is not correctly assigned by the current options merge strategy.
I opened #117 therefore, which would be a requirement for merging this PR.

@danimoh danimoh force-pushed the daniel/binarizer-performance-improvements branch from fddc609 to 25e98b3 Compare February 16, 2019 03:10
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.

None yet

1 participant