camelot-dev / camelot-dev/camelot

class ConversionBackend(object) not working as expected

Open
#381 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
3.8k
Forks
546
Avg merge
3d 17h
Merged PRs (30d)
3

Description

Hi,

As I was having problem with ghostscript and poppler, I wanted to try out the alternate pdf to image conversion backend . But not working as expected and I am not sure where am I going wrong. I tried the below code and its giving me an Opencv error.
" cv2.error: OpenCV(4.7.0) /io/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor' ".... Code is below.
Its converting pdf to png , and giving me path (ex. png_path= /tmp/tmpop73i0dk/page-1.png)
Can someone please help ?

`import camelot as cl

class ConversionBackend(object):
def convert(self, pdf_path, png_path):
pass

pdf_path="/home/user/Downloads/foo.pdf"

obj=ConversionBackend()
tbl = cl.read_pdf(pdf_path, backend=obj)
print("tbl.n=",tbl.n)
`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the custom ConversionBackend.convert method and the cl.read_pdf(..., backend=obj) call shown in the report; verify what image path and return value the backend expects. Reproduce the OpenCV !_src.empty() failure with the supplied PDF, then confirm completion by extracting the table without the error.

Written by the indexing model from the issue text.

Assessment

Tech stack
opencv, python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.