开发者

Object Recognition from Templates

开发者 https://www.devze.com 2022-12-28 14:40 出处:网络
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.

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.

I understand the basics in play here, but I'm h开发者_运维问答aving 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?

Thanks, Jonathan


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. 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.

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

  3. 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.

  4. Count valid eyes. There's your side up.

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!

0

精彩评论

暂无评论...
验证码 换一张
取 消