图像算法上的物体计数
我又接到学校任务了。这次,我的老师给我的任务是创建算法来计算图片上有多少只鸭子。
图片与此类似:
我想我应该使用模式识别来搜索上面有多少只鸭子。但我不知道每只鸭子适合哪种图案。
I got school task again. This time, my teacher gave me task to create algorithm to count how many ducks on picture.
The picture is similar to this one:
I think I should use pattern recognition for searching how many ducks on it. But I don't know which pattern match for each duck.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为你可以通过分割鸭嘴并计算连接组件的数量来解决这个问题< /a> 在二进制图像中。
要分割鸭嘴,首先将图像转换为 HSV 颜色空间,然后使用色调组件执行二值化。请注意,鸭子喙的色调与图像的其他部分不同。
I think that you can solve this problem by segmenting the ducks' beaks and counting the number of connected components in the binary image.
To segment the ducks' beaks, first convert the image to HSV color space and then perform a binarization using the hue component. Note that the ducks' beaks hue are different from other parts of the image.
这是一种方法:
圆的霍夫变换:
这非常简洁,但它可以帮助您入门。
Here's one way:
Hough transform for circles:
So that's very terse, but it can get you started.
这可能只是因为我现在正在使用 SIFT,但对我来说,它看起来可能对您的问题有好处。
它是一种在两张不同图片上匹配同一对象的算法,其中对象可以在两张图片上具有不同的方向、比例并从不同的角度观看。当一个对象被另一个对象部分隐藏(就像你的鸭子一样)时,它也可以工作。
我建议找到一张清晰的橡皮鸭图片(:D),然后使用一些 SIFT 实现(VLFeat - C 库有 SIFT 但没有可视化, SIFT++ - 基于 VLFeat,但采用 C++ 语言,Rob Hess 使用 C 语言与 OpenCV...)。
您应该记住,与 SIFT(以及其他任何东西)的匹配并不完美 - 因此您可能无法获得图片中橡皮鸭的准确数量。
It might be just because I'm working with SIFT right now, but to me it looks like it could be good for your problem.
It is an algorithm that matches the same object on two different pictures, where the objects can have different orientations, scales and be viewed from different perspectives on the two pictures. It can also work when an object is partially hidden (as your ducks are) by another object.
I'd suggest finding a good clear picture of a rubber ducky ( :D ) and then use some SIFT implementation (VLFeat - C library with SIFT but no visualization, SIFT++ - based on VLFeat, but in C++ , Rob Hess in C with OpenCV...).
You should bear in mind that matching with SIFT (and anything else) is not perfect - so you might not get the exact number of rubber duckies in the picture.