续 - 车牌检测

Continued - Vehicle License Plate Detection(续 - 车牌检测)
本文介绍了续 - 车牌检测的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

从这个线程继续:

车牌检测有哪些好的算法?

我开发了我的图像处理技术来尽可能地强调车牌,总的来说我很满意,这里有两个示例.

I've developed my image manipulation techniques to emphasise the license plate as much as possible, and overall I'm happy with it, here are two samples.

现在是最困难的部分,实际检测车牌.我知道有一些边缘检测方法,但我的数学很差,所以我无法将一些复杂的公式翻译成代码.

Now comes the most difficult part, actually detecting the license plate. I know there are a few edge detection methods, but my maths is quite poor so I'm unable to translate some of the complex formulas into code.

到目前为止,我的想法是遍历图像中的每个像素(基于 img 宽度和高度的 for 循环)由此将每个像素与颜色列表进行比较,由此检查算法以查看颜色是否保持不变区分车牌白色和文本的黑色.如果发生这种情况,这些像素会被构建到内存中的新位图中,那么一旦停止检测到这种模式,就会执行 OCR 扫描.

My idea so far is to loop through every pixel within the image (for loop based on img width & height) From this compare each pixel against a list of colours, from this an algorithm is checked to see if the colors keep differentiating between the license plate white, and the black of the text. If this happens to be true these pixels are built into a new bitmap within memory, then an OCR scan is performed once this pattern has stopped being detected.

我很感激对此的一些意见,因为这可能是一个有缺陷的想法,太慢或太密集.

I'd appreciate some input on this as it might be a flawed idea, too slow or intensive.

谢谢

推荐答案

你的看颜色是否不断区分车牌白色和文本的黑色"的方法基本上是寻找像素强度变化的区域从黑色到白色,反之亦然很多次.边缘检测可以完成基本相同的事情.但是,实现自己的方法仍然是一个好主意,因为您将在此过程中学到很多东西.哎呀,为什么不两者都做,并将您的方法的输出与一些现成的边缘检测算法的输出进行比较?

Your method of "see if the colors keep differentiating between the license plate white, and the black of the text" is basically searching for areas where the pixel intensity changes from black to white and vice-versa many times. Edge detection can accomplish essentially the same thing. However, implementing your own methods is still a good idea because you will learn a lot in the process. Heck, why not do both and compare the output of your method with that of some ready-made edge detection algorithm?

在某些时候,您会想要一个二值图像,例如黑色像素对应于非字符"标签,白色像素对应于是字符"标签.也许最简单的方法是使用阈值函数.但这只有在角色已经以某种方式强调的情况下才会有效.

At some point you will want to have a binary image, say with black pixels corresponding to the "not-a-character" label, and white pixels corresponding to the "is-a-character" label. Perhaps the simplest way to do that is to use a thresholding function. But that will only work well if the characters have already been emphasized in some way.

正如您在另一个帖子中提到的那样,您可以使用黑帽运算符来执行此操作,结果如下:

As someone mentioned in your other thread, you can do that using the black hat operator, which results in something like this:

如果您使用 Otsu 的方法(自动确定全局阈值级别)对上面的图像进行阈值处理,您会得到:

If you threshold the image above with, say, Otsu's method (which automatically determines a global threshold level), you get this:

有几种方法可以清理该图像.例如,您可以找到连接的组件并丢弃那些太小、太大、太宽或太高而不能成为角色的组件:

There are several ways to clean that image. For instance, you can find the connected components and throw away those that are too small, too big, too wide or too tall to be a character:

由于图像中的字符相对较大且完全连接,因此此方法效果很好.

Since the characters in your image are relatively large and fully connected this method works well.

接下来,您可以根据邻居的属性过滤剩余的组件,直到您拥有所需数量的组件(= 字符数).如果您想识别字符,您可以计算每个字符的特征并将它们输入到分类器中,该分类器通常使用监督学习构建.

Next, you could filter the remaining components based on the properties of the neighbors until you have the desired number of components (= number of characters). If you want to recognize the character, you could then calculate features for each character and input them to a classifier, which usually is built with supervised learning.

当然,上述所有步骤只是一种方法.

All the steps above are just one way to do it, of course.

顺便说一句,我使用 OpenCV + Python 生成了上面的图像,这是计算机视觉的绝佳组合.

By the way, I generated the images above using OpenCV + Python, which is a great combination for computer vision.

这篇关于续 - 车牌检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

Custom Error Queue Name when using EasyNetQ for RabbitMQ?(使用 EasyNetQ for RabbitMQ 时自定义错误队列名称?)
How to generate password_hash for RabbitMQ Management HTTP API(如何为 RabbitMQ 管理 HTTP API 生成密码哈希)
Rabbitmq Ack or Nack, leaving messages on the queue(Rabbitmq Ack 或 Nack,将消息留在队列中)
Setup RabbitMQ consumer in ASP.NET Core application(在 ASP.NET Core 应用程序中设置 RabbitMQ 消费者)
Specify Publish timeouts in mass transit(指定公共交通中的发布超时)
RabbitMQ asynchronous support(RabbitMQ 异步支持)