模板中的对象识别 [英] Object Recognition from Templates

查看:59
本文介绍了模板中的对象识别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望有人可以在这里指出正确的方向.上面有一张骰子的图片(我从上方),我想知道哪一侧朝上.

I was hoping someone could point me in the right direction here. With a picture of a die (from above) I want to recognize which side is up.

我了解这里的基础知识,但是在掌握OpenCV的功能方面遇到了麻烦.我想我想要一张每张骰子的照片.然后,我可以将它们全部与要分类的当前图像进行比较.我该如何使用OpenCV做到这一点?

I understand the basics in play here, but I'm having trouble grasping the power of OpenCV. I imagine I want a picture of each side of the die. Then I can somehow compare them all to the current image to be classified. How can I use OpenCV to do this?

谢谢, 乔纳森

推荐答案

虽然可行,并且OpenCV具有模板匹配功能,但可能比必要的难.要取得良好的效果,就需要所有图像之间的照明或多或少保持不变,并且相机必须固定并且不发生投影失真.

While that would work and OpenCV has template matching functions, it would probably be harder than necessary. Good results would require that the lighting is more or less unchanged between all images, and that the camera is fixed and no projective distorsions occur.

相反,我会做这样的事情:

Instead, I would do something like this:

  1. 在图像中,找到骰子.这里的困难将根据骰子的外观和背景而变化.如果您在浅黑色(或其他颜色)的背景上有白色骰子,那么找到骰子将很容易.

  1. In the image, locate the die. The difficulty here will vary with regard to how the die looks and the background. If you have a white die on a lpain black (or some other color) background then finding the die will be easy.

找到裸片后,找到眼睛.只需找到所有黑色斑点即可完成此操作.

When the die has been located, find the eyes. This can be done by simply finding all black blobs.

如有必要,请确保找到的眼睛形成连贯的图案.例如.如果正面朝上是四,则您希望将眼睛看成是正方形而不是直线上的角.

If necessary, make sure that the found eyes form a coherent pattern. E.g. if the side up is four you expect to find the eyes as the corners in a square, not on a straight line.

算出有效的眼睛.有你的一面.

Count valid eyes. There's your side up.

由于执行每个步骤有很多方法,因此此轮廓非常模糊.但是,我确实相信您所需的一切都可以在OpenCV中找到. 祝你好运!

This outline is quite vague as there are lots of ways of performing each step. I do however believe that everything you need is available in OpenCV. Good luck!

这篇关于模板中的对象识别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆