qurator-spk / eynollah

Document Layout Analysis
Apache License 2.0
340 stars 29 forks source link

cvtColor error #128

Closed bertsky closed 4 months ago

bertsky commented 4 months ago

In #108 we recently (probably because of a new OpenCV release) started to see this error:

INFO eynollah - INPUT FILE df_ld_0022741 (11/12) 
OpenCV(4.8.0) :-1: error: (-5:Bad argument) in function 'cvtColor'
> Overload resolution failed:
>  - src is not a numpy array, neither a scalar
>  - Expected Ptr<cv::UMat> for argument 'src'

INFO eynollah - Resizing and enhancing image...

I checked all places where cv2.cvtColor is used, and AFAICS it always gets passed a Numpy array. Unfortunately, OpenCV does not show the exact stack trace...

vahidrezanezhad commented 4 months ago

@bertsky Could you please share the input file? And does this happen in the OCR-D pipeline or in the standalone Eynollah?

bertsky commented 4 months ago

Oops, sry, my local branch already had a few more commits I forgot about, which exposed a problem with check_dpi.

See https://github.com/qurator-spk/eynollah/pull/108/commits/60cf0bddfd35dd3fcd87b2e077b05bb170983977

(IOW the type checking for PIL.Image was wrong, which had the conditional enter the branch expecting an array)

Would you like me to make a cherry-picked PR for this fix?

vahidrezanezhad commented 4 months ago

Oops, sry, my local branch already had a few more commits I forgot about, which exposed a problem with check_dpi.

See 60cf0bd

(IOW the type checking for PIL.Image was wrong, which had the conditional enter the branch expecting an array)

Would you like me to make a cherry-picked PR for this fix?

Yes, sure.

bertsky commented 4 months ago

Oh, wow! I just realised that I had already fixed this in https://github.com/qurator-spk/eynollah/commit/867a7261de27bec7efc7e7add80f10ae18bc419a.

But somehow, I seemed to have forgot including #109 in #108.