opencv / opencv

Open Source Computer Vision Library
https://opencv.org
Apache License 2.0
78.56k stars 55.77k forks source link

Text Detection in Python returning TypeError #23171

Open l3ra opened 1 year ago

l3ra commented 1 year ago

System Information

Python opencv_version = "4.5.5.64" Operating System / Platform: MacOs Monterey 12.6 Python version: 3.9.13

Detailed description

Running the script here:

https://github.com/opencv/opencv/blob/master/samples/dnn/text_detection.py

With command:

python opencv-east.py --model="frozen_east_text_detection.pb"

Returns error:

Traceback (most recent call last):
  File "/Users/x/x/lx/opencv-east.py", line 241, in <module>
    main()
  File "/Users/x/x/x/opencv-east.py", line 200, in main
    vertices = cv.boxPoints(boxes[i])
TypeError: only integer scalar arrays can be converted to a scalar index

Steps to reproduce

Copy - paste file.

Run with `python opencv-east.py --model="frozen_east_text_detection.pb"

Issue submission checklist

vortex73 commented 1 year ago

@l3ra I would like to try my hand at this if its still active?

berak commented 1 year ago

@l3ra , please try again with latest opencv 4.7.0 (internal python wrapping of c++ std::vector has changed starting with 4.6, see previous version)

sambutle1 commented 1 year ago

This error message suggests that a function or operation is expecting an integer scalar index (single integer) as an index, but is instead receiving an array or a non-integer value. This can occur when attempting to index or slice an array with a non-integer or non-scalar value. To resolve this error, ensure that the index being used is a single integer and not an array or non-integer value. If working with arrays, consider using integer indexing or slicing methods to access specific elements or subsets of the array.

asmorkalov commented 3 weeks ago

@gursimarsingh could you take a look?