绘制一条线来跟踪对象 [英] draw a line for tracking the object

查看:93
本文介绍了绘制一条线来跟踪对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CvSeq* circles = cvHoughCircles( gray, cvCreateMemStorage(0), CV_HOUGH_GRADIENT, 2 , gray->height/6, 3 );
printf ("%d circles detected\n", circles->total);
int *px = new int[circles->total];
int *py = new int[circles->total];
if(circles->total > 0) {
int i = 0;
float * p = (float*)cvGetSeqElem( circles, i );
int i=0;
px[i]=cvRound(p[0]);
py[i]=cvRound(p[1]);
int radius = cvRound(p[2]);
int measurement[] = { px[i], py[i] };





以类似的方式,我想用opencv c ++画一条线而不是圆圈。任何人都可以帮忙。



In the similar way i want to draw a line instead of circle using opencv c++. Can anyone help please.

推荐答案

你的圈子的坐标存储在 px 吡啶。因此,您只需使用这些坐标就可以使用 [ ^ ]功能。



您还应该考虑使用新的openCV API。您正在使用旧版C的openCV。现在有一个新的C ++版本,这使得许多任务更容易实现,理解并且更不容易出错。
The coordinates of your circle are stored in px and py. So you can simply use these coordinates to draw a line with the line[^] function.

You should also consider using the new openCV API. You are working with the older C version of openCV. There exists a new C++ version for quite some time now which makes many tasks easier to implement, understand and also less error prone.


这篇关于绘制一条线来跟踪对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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