mzucker/page_dewarp

Python3 issues

Opened this issue · 1 comments

First all print statements need to be converted from print "" to print()

floating point errors here:
561 wrap values in int() due to floating point error
795 int(width...)
796 int(height....)


general errors which need handling

some text is white washed away

DSC05331
z

Traceback (most recent call last):
File "page_dewarp.py", line 915, in
main()
File "page_dewarp.py", line 868, in main
cinfo_list = get_contours(name, small, pagemask, 'text')
File "page_dewarp.py", line 470, in get_contours
contours_out.append(ContourInfo(contour, rect, tight_mask))
File "page_dewarp.py", line 376, in init
self.center, self.tangent = blob_mean_and_tangent(contour)
File "page_dewarp.py", line 352, in blob_mean_and_tangent
mean_x = moments['m10'] / area
ZeroDivisionError: float division by zero

apparently area can be 0 so we need to protect against this

If area==0:
area=1

Resizing the image resulted in problems for me, so I nulled it out with img=src

It looks like there are already some open PRs to update the codebase: #14, #15, #20, #25 (most recent) in case they are useful to you.