putText() missing required argument 'org' (pos 3)
时间: 2024-05-07 21:15:32 浏览: 94
The error message "putText() missing required argument 'org' (pos 3)" indicates that the function putText() is missing the 'org' argument in its third position. The 'org' argument is used to define the coordinates of the text location on the image.
To fix this error, you need to provide the 'org' argument with the appropriate coordinates. For example:
```
import cv2
# Read the image
img = cv2.imread('image.jpg')
# Define the text and font
text = 'Hello World'
font = cv2.FONT_HERSHEY_SIMPLEX
# Define the text location
org = (50, 50)
# Draw the text on the image
cv2.putText(img, text, org, font, 1, (255, 0, 0), 2)
# Display the image
cv2.imshow('Image', img)
cv2.waitKey(0)
cv2.destroyAllWindows()
```
In this example, we have defined the coordinates of the text location as (50, 50) and passed it as the 'org' argument in the putText() function.
阅读全文