V
V
Vladimimary2020-06-10 01:05:07
Django
Vladimimary, 2020-06-10 01:05:07

Why is file not being processed by opencv from Django form?

Uploading a file using forms in Django and trying to process it. In the following way:

[PYTHON]
        if form.is_valid():
            rb = form.save(commit=False)
            pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files (x86)\Tesseract-OCR5\tesseract.exe'
            rb.text = pytesseract.image_to_string(Image.open(rb.image), lang='rus')
            im = cv2.imread(rb.image)
            rb.for_what= rec(rb.image)
            rb.delegate= 's'
            rb.date = 's'
            rb.delegate = 'f'
            rb = form.save()
            return redirect('main:profile')
[/PYTHON]


why through Image.open(rb.image) everything is fine and the file is opened, while cv2.imread(rb.image) gives an error returned NULL without setting an error5ee0072ba6645315819466.jpeg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dr. Bacon, 2020-06-10
@bacon

Understand what cv2.imread and Image.open expect as a parameter and what rb.image returns

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question