'Error in opencv (bad argument in function rectangle)

I was working on a facial recognition project on python. While running the code, I encountered an error as shown below: enter image description here

The code was running for a brief moment. Then, the error appeared.

Here's my code:

if display_camera:
                for roi, landmarks, identity, age_gender, emotion, age in zip(*outputs):
                    label = face_identifier.get_identity_label(identity.id)
                    label_2 = str(int(round((age_gender.get_age() + age.get_age())/2 ))) + " " + str(age_gender.get_gender()[0])
                    label_3 = str(emotion.get_dominant_emotion()[0])
                    cv2.rectangle(orig_image, tuple(roi.position) , tuple(roi.position + roi.size), 
                        (0, 220, 0), 2)
                    x, y = roi.position 
                    w, h = roi.size
                    left = int(x)
                    bottom = int(y)
                    right = int(x+w)
                    top = int(y+h)

                    cv2.rectangle(orig_image, (left, bottom - 35), (right, bottom), (0, 0, 255), cv2.FILLED)
                    font = cv2.FONT_HERSHEY_DUPLEX
                    cv2.putText(orig_image, label, (left + 6, bottom - 6), font, 0.5, (255, 255, 255), 1)
                    cv2.putText(orig_image, label_2, (left + 6, bottom - 20), font, 0.5, (255, 255, 255), 1)
                    cv2.putText(orig_image, label_3, (left + 6, bottom - 34), font, 0.5, (255, 255, 255), 1)
                startTime = time.time()

                cv2.imshow('Video', orig_image)

Did anyone have any thought to solve it? Thanks for your help!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source