ulikoehler / OTR

Optical table recognition - recognize tables in scan images using OpenCV
GNU General Public License v3.0
110 stars 40 forks source link

not enough values to unpack #8

Open PiotrFerenc opened 5 years ago

PiotrFerenc commented 5 years ago

file: http://www.nasflmuseum.com/uploads/4/9/5/8/4958573/_7848632_orig.jpg

python3 test-otr.py test2.jpg


Traceback (most recent call last):
  File "test-otr.py", line 56, in <module>
    img = runOTR(args.infile)
  File "test-otr.py", line 18, in runOTR
    contour_analyzer = TableRecognition.ContourAnalyzer(imgDil)
  File "/home/piotr/OTR/TableRecognition.py", line 76, in __init__
    im2, contours, hierarchy = cv2.findContours(img, cv2.RETR_TREE, cv2.CHAIN_APPROX_TC89_KCOS, **kwargs)
ValueError: not enough values to unpack (expected 3, got 2)

Python 3.6.3 Distributor ID: Ubuntu Description: Ubuntu 17.10 Release: 17.10 Codename: artful OpenCV: 3.1.0

ulikoehler commented 5 years ago

Thanks for reporting this. Probably I can't take a look until early next week. It seems to fail at a pretty early stage in the process so I believe that some addition preprocessing will be required to the image.

PiotrFerenc commented 5 years ago

What version do you use?

traumatic commented 5 years ago

Any news?

PiotrFerenc commented 5 years ago

nope

jewelcai commented 5 years ago

downgrade your opencv-python or delete the first return value of find_contour()

ulikoehler commented 5 years ago

Sorry, could not have a look at this earlier. I will now try to find a portable solution.

ulikoehler commented 5 years ago

Could any of you guys test the solution? The fix should be pretty straightforward if I understand the issue correctly, I just don't have any good test data available at the moment.

jewelcai commented 5 years ago

Could any of you guys test the solution? The fix should be pretty straightforward if I understand the issue correctly, I just don't have any good test data available at the moment.

it is acceptable.

ulikoehler commented 5 years ago

@jewelcai Thanks for checking! Any suggestions on how to make it better than just acceptable?

jewelcai commented 5 years ago

@jewelcai Thanks for checking! Any suggestions on how to make it better than just acceptable?

haha。 Acceptable means the issue is fixed.

PiotrFerenc commented 5 years ago

Any news?

ulikoehler commented 5 years ago

@PiotrFerenc It should be fixed... Can you test?

PiotrFerenc commented 5 years ago

obraz

python3-opencv 3.1.0 python3-scipy 0.18.1.1 python3-numpy 1.12

ulikoehler commented 5 years ago

@PiotrFerenc Thanks! This seems to happen at a different location than the one I've already fixed for some reason. I have just pushed a commit that should fix that instance as well. Could you pull and test again?