My goal is to have a working script for identifying a table on an image. I stumbled upon this posts answer: https://stackoverflow.com/a/51756462/10434683 He is exactly doing what I need. However if I run this code I get an error that looks like this:
It seems like the error is caused by the boundingRect() function. Ive looked up the docs, however didnt find anything useful.
The following is the function where boundingRect() is used...
def find_text_boxes(pre, min_text_height_limit=6, max_text_height_limit=40):
# Looking for the text spots contours
contours = cv2.findContours(pre, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)
contours = contours[0] if imutils.is_cv2() else contours[1]
# Getting the texts bounding boxes based on the text size assumptions
boxes = []
for contour in contours:
box = cv2.boundingRect(contour) #error
h = box[3]
if min_text_height_limit < h < max_text_height_limit:
boxes.append(box)
return boxes