如何从这张照片中获取人物。我尝试了代码,但是OCR仍然很难识别
import cv2
TEXT_TOP = 680
TEXT_BOTTOM = 740
TEXT_LEFT = 280
TEXT_RIGHT = 1080
img = cv2.imread ('2.jpg')
cropped = img [TEXT_TOP: TEXT_BOTTOM, TEXT_LEFT: TEXT_RIGHT]
white_region = cv2.inRange (cropped, (200, 200, 200), (255, 255, 255))
cv2.imshow ('white_region', white_region)
cv2.waitKey (10000)
答案 0 :(得分:1)
遵循此link,它将帮助您从图像中提取文本,但是根据您的问题,建议您遍历图像的帧并应用link方法从整个视频中提取文本。想只提取字幕,然后只扫描帧的页眉和页脚中的文本。