lmmx / page-dewarp

Document image dewarping library using a cubic sheet model
MIT License
98 stars 17 forks source link

Misbehaviour of dimensions for some warped images #17

Open StaelTchinda opened 9 months ago

StaelTchinda commented 9 months ago

Hi,

first I want to thank you for your work.

The algorithm works fine for images, where all the document can be seen and is flat. However, I have a case of a document, where the dimensions of the image are incorrectly computed. (Look part of the verbose below.) Maybe more constraints on the dimensions or corners or coordinates computations are required.

Loaded 67c656c099c941ae759.jpeg at size='1800x1013' --> resized='900x506'
  got 3 spans with 17 points.
  initial objective is 0.00017673946556242466
  optimizing 28 parameters...
  optimization took 0.21 sec.
  final objective is 7.04562825312913e-05
  got page dims 811571190.8768755 x 1.1532271561006338
  output will be 416613624176x592

I am not very familiar with how the code works, but if you know how the problem may be solved, you could quickly explain to me so that I implement it and create a pull request.

Best regards,

SpicyCatGames commented 6 months ago

Having the document would be very helpful. Please provide it if it's something you can share.

joguy56 commented 5 months ago

I encountered the same issue on pages that are near to be blank pages for example title pages where there is only one line, one block of text.

I observed that if the page contains multiple lines of text, it is fine.