Python Ocr车牌识别

Python Ocr Licence Plate Recognition

我尝试使用自适应阈值将图像转换为灰色,Thesh_Binary_Inv

gray = cv2.cvtColor(img1,cv2.COLOR_BGR2GRAY)
adapt1 = cv2.adaptiveThreshold(gray,130,cv2.ADAPTIVE_THRESH_GAUSSIAN_C,cv2.THRESH_BINARY_INV,153,40)

并尝试使用 pytesser 获取车牌,但得到了一些随机值作为输出

任何人都可以帮助我从图像中提取文本以及在哪里可以找到有关如何使用 kmeans 或任何其他算法进行训练的教程

从图像中提取文本时,请尝试以尽可能清晰地查看文本的方式查看图像。我的教授曾经说过:如果人类可以看到它,那么计算机也可以看到它。你想要做的基本上是执行基本的预处理算法,如对比度增强、颜色 space 转换(如果需要)等。你想要在阈值化之前获取的是尽可能清晰的图像,其中的字符毫无疑问并且字符和白色背景之间的边缘尽可能明显。

您需要尝试阈值操作。一开始我建议使用带有轨迹栏的简单、固定的阈值函数,这样您就不必在每次要更改值时都重新运行代码。您可以在 here, on my GitHub repo. Of course that's only one of the steps. You still need to find the area that's of interest to you and the characters. What you want to look at for those steps is probably contour finding.

上找到代码

训练部分会更加棘手。有一个关于 K-means here but I would guess that you're not really sure what to do with it. I'm not sure what to recommend here, as Machine Learning might be a little too hard for you before you got the basics. Anyway, if I were to do it, I'd probably go for Deep Learning but you need to know that the testing data and how you prepare it will be crucial in the process. Here's a very simple tutorial 的漂亮入门级教程,可能会让您了解发生了什么。

Raaj,请记住,如果您希望人们努力帮助您,那么首先努力询问是一种礼貌。你必须更好地解释你尝试了什么,你在哪里看,你得到了什么结果以及你对我们的期望。图片,我想说,在你的情况下是必须的,你甚至懒得提供这些。祝你好运!