我这是我的密码
# Json file in which Easyocr anotations have saved.
img = cv2.imread('dummy.jpg')
img1 = img.copy()
#rotoated because anotation have according to vertical alignment of image i have matched the orientation
img1=cv2.rotate(img1,rotateCode=cv2.ROTATE_90_CLOCKWISE)
rects = []
with open('dummy.json') as jsn:
jsn_dict = json.load(jsn)
for k in jsn_dict['textAnnotations']:
vertices= k['boundingPoly']['vertices']
cv2.rectangle(img1,list(vertices[2].values()),list(vertices[0].values()),[0,255,0],10)
# I want to put predicted text on top of bounding boxes vertically because my image is rotated anti clockwise
cv2.putText(img1, k['description'], list(vertices[0].values()),cv2.FONT_HERSHEY_SIMPLEX,5,[0,255,0],5)
我在上面提到的代码中标记识别的文本,
第一步是,我将图像放入OCR模型,它根据图像返回一些值,其中每个检测到的文本有三个值。这些值是边界框的顶点、已识别的文本和精度百分比。但我的问题是,我的图像被Exif方向值旋转,但cv2将其读取为零角度,而我的文本是水平打印的。我想在图像上垂直打印文本。我试了很多次,但都没能解决我的问题。我希望我已经解释清楚了