繁体   English   中英

OpenCV从camshift算法输出中绘制一个椭圆。

[英]OpenCV drawing an ellipse from the camshift algorithm output.

我使用camshift跟踪网球,并在网球周围绘制了一个椭圆。 但是,我经常收到此错误

OpenCV Error: Assertion failed (box.size.width >= 0 && box.size.height >= 0 &&       thickness <= 255) in ellipse, file /home/eanders/src/OpenCV-2.4.2/modules/core/src/drawing.cpp, line 1678 terminate called after throwing an instance of 'cv::Exception'
what():  /home/eanders/src/OpenCV-2.4.2/modules/core/src/drawing.cpp:1678: error: (-215) box.size.width >= 0 && box.size.height >= 0 && thickness <= 255 in function ellipse

我假设camshift方法返回的RotatedRect对象在某种程度上不是要在其中绘制椭圆的正确尺寸。 任何想法如何纠正这一点? 代码如下。 在此先感谢大家。

Rect trackWindow = Rect(p1, box);
///employ camshift algorithm
RotatedRect trackBox = CamShift(backproj, trackWindow, TermCriteria( CV_TERMCRIT_EPS | CV_TERMCRIT_ITER, 10, 1 ));
ellipse( image, trackBox, Scalar(255,255,255), 3, CV_AA );
ellipse( backproj, trackBox, Scalar(255,255,255), 3, CV_AA );

在我看来,算法似乎无法跟踪对象。 知道为什么会很棒,但是现在我将检查旋转矩形的尺寸。 这显然是断言所抱怨的。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM