如何在opencv中旋转椭圆形? [英] How do I rotate an elipse in opencv?

查看:86
本文介绍了如何在opencv中旋转椭圆形?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我在opencv中有一个小项目,只是从静态图像中区分笔中的硬币.它所做的基本上就是找到每个对象的轮廓,并在其周围绘制最合适的椭圆形.

硬币很好,我要解决的问题是应该围绕每支笔的每个椭圆都居中且正确大小,但与对象成90度角.香港专业教育学院使用cvelipsebox函数,我想知道是否有一个函数来将此椭圆旋转90度?我一直在搜索,但是找不到解决方案...如果我的代码可以简化操作,请告诉我您需要看什么


任何帮助都将得到真正的应用

Martyn

Hi guys

I have a little project in opencv, just distinguishing coins from pens from a static image. All it does is basically find the contours of each object and draws a best fit elipse around it.

The coins are fine, problem I have is each elipse which is supposed to surround each pen is centered and the correct size but sits at a 90 degree angle to the object. Ive used the cvelipsebox function and I was wondering if there was a function to rotate this elipse 90 degrees? I''ve been googing but an''t find a solution...If my code would make it easier, just let me know what you need to see


Any help would really be appriciated

Martyn

推荐答案

不确定此opencv是什么,但是如果通过指定X,Y,宽度和高度绘制椭圆,则切换width和hight值将产生一个旋转90度.

抱歉,如果我没有做到这一点

(不太确定如何处理此问与答的东西)

这些功能? http://opencv.willowgarage.com/documentation/cpp/drawing_functions.html
...椭圆函数的第一个重载采用角度值作为第四参数.可以将其设置为-90或90,以提供所需的正确旋转度.从链接的图中可以看到,椭圆最初开始指向右边(90度),所以我假设您的图形默认为0角.
not sure what this opencv is but if you are drawing an ellipse by specying X, Y, width and height then switch the width and hight values would produce a 90 degree rotation.

Sorry if I am off the mark with this one

(Not quite sure how to work this Q&A stuff yet)

These functions? http://opencv.willowgarage.com/documentation/cpp/drawing_functions.html
...the first overload for ellipse function takes an angle value as the forth parameter. This could be set as -90 or 90 to give the correct rotation you would need. As you can see from the diagram in the link, the ellipse initially starts pointing to the right (90 degrees) so I would assume your drawing is defaulting to an angle of 0


这篇关于如何在opencv中旋转椭圆形?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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