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

allow processing of rgb images #8

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

Conversation

JBBalling
Copy link
Collaborator

#2
I dont know exactly if this is what you are expecting, but I tested it with RGB Images and was able to process those, even with postprocessing.

Copy link
Owner

@bertsky bertsky left a comment

Choose a reason for hiding this comment

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

Please elaborate, or start with the error you were getting...

Comment on lines -270 to +272
# get connected components to estimate scale
# get connected components to estimate ignorescale
Copy link
Owner

Choose a reason for hiding this comment

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

?

page_image_bin.width,
page_image_bin.height - int(np.ceil(-diff / 2))))
# check wether input image is binarized
if page_image_info.photometricInterpretation == "1":
Copy link
Owner

Choose a reason for hiding this comment

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

That's a strange thing to query: it is only defined if the image was a TIFF (Pillow's TIFF plugin), and it does not even discern binarized vs others: binarized would be .mode == '1'. This signifies BlackIsZero, which could be true for

  • binarized
  • grayscale 8-bit
  • grayscale 8-bit plus alpha 8-bit
  • grayscale 16-bit int
  • grayscale 32-bit int
  • grayscale 32-bit float

I don't understand the purpose yet: what did go wrong before?

Comment on lines -228 to +230
page_image_bin = page_image_bin.convert(mode='1')
page_image_bin = page_image_raw.convert(mode='1')
Copy link
Owner

Choose a reason for hiding this comment

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

That's not going to work well: binarization is usually more than a simple conversion – you have to find the best threshold, ideally localized across the image.

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