【发布时间】:2021-04-15 03:25:06
【问题描述】:
我有这段代码用于检测图像上的文本并用绿色矩形对其进行边界并将每个边界文本提取到一个单独的图像中,我已经完成了这一步但是当它生成时我尝试打开图像它非常小我看不到它,我尝试应用调整大小但不起作用。请帮帮我。
img = cv2.imread(IMAGE_PATH)
copy = img.copy()
ROI_number = 0
for detection in result:
top_left = tuple([int(val) for val in detection[0][0]])
bottom_right = tuple([int(val) for val in detection[0][2]])
#text = detection[2]
#font= cv2.FONT_HERSHEY_SIMPLEX
img = cv2.rectangle(copy, top_left, bottom_right, (36,255,12), 2)
ROI = copy[top_left, bottom_right]
img2 = cv2.resize(ROI, dsize=(0,0), fx=5, fy=5)
cv2.imwrite('ROI_{}.jpg'.format(ROI_number), ROI)
#img = cv2.putText(img,text,(20,spacer), font, 1,(0,255,0),2,cv2.LINE_AA)
ROI_number += 1
#plt.figure(figsize=(30,30))
plt.imshow(img)
plt.show
cv2.imshow('copy', copy)
cv2.waitKey()
【问题讨论】:
标签: python image-processing bounding-box