OCR-D / ocrd_all

Master repository which includes most other OCR-D repositories as submodules
MIT License
72 stars 17 forks source link

eynollah: contour data type = 17 is not supported #368

Closed jbarth-ubhd closed 1 year ago

jbarth-ubhd commented 1 year ago

Using ocrd.sif built from ocrd/all:maximum at 2023-06-13 18:00 CEST

Tried with the image here:

https://digi.ub.uni-heidelberg.de/diglitData/v/duerer1527_-_aa2.tgz

... and essential the same workflow as in run.sh. See complete workflow at bottom.

13:07:36.601 ERROR ocrd.processor.helpers.run_processor - Failure in processor 'ocrd-eynollah-segment'                                    
Traceback (most recent call last):                                                                                                        
  File "/build/core/ocrd/ocrd/processor/helpers.py", line 128, in run_processor                                                           
    processor.process()                                                                                                                   
  File "/usr/local/lib/python3.8/site-packages/qurator/eynollah/processor.py", line 59, in process                                        
    Eynollah(**eynollah_kwargs).run()                                                                                                     
  File "/usr/local/lib/python3.8/site-packages/qurator/eynollah/eynollah.py", line 2276, in run                                           
    cx_bigest, cy_biggest, _, _, _, _, _ = find_new_features_of_contours(contours_only_text_parent)                                       
  File "/usr/local/lib/python3.8/site-packages/qurator/eynollah/utils/contour.py", line 80, in find_new_features_of_contours
    areas_main = np.array([cv2.contourArea(contours_main[j]) for j in range(len(contours_main))])
  File "/usr/local/lib/python3.8/site-packages/qurator/eynollah/utils/contour.py", line 80, in <listcomp>
    areas_main = np.array([cv2.contourArea(contours_main[j]) for j in range(len(contours_main))])
cv2.error: OpenCV(4.7.0) :-1: error: (-5:Bad argument) in function 'contourArea'
> Overload resolution failed:
>  - contour data type = 17 is not supported
>  - Expected Ptr<cv::UMat> for argument 'contour'

Workflow en detail:

ocrd workspace init
ocrd workspace add -g P_00001 -G OCR-D-IMG -i OCR-D-IMG_00001 -m image/tiff OCR-D-IMG/00001.tif

ocrd-olena-binarize -P impl wolf -P k 0.10 -I OCR-D-IMG -O OCR-D-001
ocrd-tesserocr-crop -I OCR-D-001 -O OCR-D-002
ocrd-olena-binarize -P impl wolf -P k 0.10 -I OCR-D-002 -O OCR-D-003
ocrd-tesserocr-deskew -P operation_level page -I OCR-D-003 -O OCR-D-004
ocrd-eynollah-segment -P models default -I OCR-D-004 -O OCR-D-005
ocrd-tesserocr-recognize -P model frak2021 -I OCR-D-005 -O OCR-D-OCR
bertsky commented 1 year ago

Not sure if this is related to https://github.com/qurator-spk/eynollah/issues/106.

For OCR-D, please downgrade to https://github.com/qurator-spk/eynollah/pull/108 – or use the current version of ocrd_all, just released today.

If the problem persists, please report with a test data (input image) directly to eynollah repository.

jbarth-ubhd commented 1 year ago

Updated ocrd.sif today 14:12 CEST

approx. the same error:

15:05:05.439 ERROR ocrd.processor.helpers.run_processor - Failure in processor 'ocrd-eynollah-segment'
Traceback (most recent call last):
  File "/build/core/ocrd/ocrd/processor/helpers.py", line 128, in run_processor
    processor.process()
  File "/build/eynollah/qurator/eynollah/processor.py", line 59, in process
    Eynollah(**eynollah_kwargs).run()
  File "/build/eynollah/qurator/eynollah/eynollah.py", line 2277, in run
    cx_bigest, cy_biggest, _, _, _, _, _ = find_new_features_of_contours(contours_only_text_parent)
  File "/build/eynollah/qurator/eynollah/utils/contour.py", line 80, in find_new_features_of_contours
    areas_main = np.array([cv2.contourArea(contours_main[j]) for j in range(len(contours_main))])
  File "/build/eynollah/qurator/eynollah/utils/contour.py", line 80, in <listcomp>
    areas_main = np.array([cv2.contourArea(contours_main[j]) for j in range(len(contours_main))])
TypeError: Expected Ptr<cv::UMat> for argument 'contour'
jbarth-ubhd commented 1 year ago

Reported it to eynollah: https://github.com/qurator-spk/eynollah/issues/110

bertsky commented 1 year ago

Thanks!