[英]Translate this car plate image into text
I want to turn the car plate into text.我想把车牌变成文字。
After I do crop of the plates with python-opencv
:在我用
python-opencv
裁剪盘子后:
pytesseract.image_to_string(bbox, lang='eng', config='--psm 6')
returns me: "TH
pytesseract.image_to_string(bbox, lang='eng', config='--psm 6')
返回我: "TH
My code for cropping:我的裁剪代码:
coordinates = [[0.6703869047619048, 0.39855072463768115],
[0.7672123015873016, 0.39855072463768115],
[0.7672123015873016, 0.47681159420289854],
[0.6703869047619048, 0.47681159420289854],
[0.6703869047619048, 0.39855072463768115]]
img = cv.imread(pic)
height, width, channels = img.shape
bbox_coordinates = [[int(coordinate[0] * width), int(coordinate[1] * height)] for coordinate in coordinates]
Then I turn it for better quality into greyscale:然后我把它变成灰度:
bbox = cv.cvtColor(bbox, cv.COLOR_BGR2GRAY)
pytesseract.image_to_string(bbox, lang='eng', config='--psm 6')
returns: To
pytesseract.image_to_string(bbox, lang='eng', config='--psm 6')
返回: To
Is there a way to get WA 6728 M
?有没有办法获得
WA 6728 M
? (with or without usage of pytesseract 4
) (使用或不使用
pytesseract 4
)
I try this picture: https://i.stack.imgur.com/HLgiF.jpg我试试这张图: https : //i.stack.imgur.com/HLgiF.jpg
def process_image(image):
pytesseract.pytesseract.tesseract_cmd = 'C:\\Users\\abenhari\\AppData\\Local\\Tesseract-OCR\\tesseract.exe'
img = Image.open(image)
img = img.convert('L')
pix = img.load()
plt.imshow(img)
plt.show()
return pytesseract.image_to_string(img)
print(process_image("plat1.jpg"))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.