求解圆心怎么输出!求大神指点!

heykaokao 2012-10-26 03:15:31
if( cascade )
{
double t = (double)cvGetTickCount();//?? cvGetTickCount ???????????(????? CPU ?ticks ??)??? tics ???
CvSeq* faces = cvHaarDetectObjects( small_img, cascade, storage, //????????(?) CvSeq?????????
1.2, 5, 0
//|CV_HAAR_FIND_BIGGEST_OBJECT
//|CV_HAAR_DO_ROUGH_SEARCH
|CV_HAAR_DO_CANNY_PRUNING
//|CV_HAAR_SCALE_IMAGE
,
cvSize(10, 40) );
t = (double)cvGetTickCount() - t;
printf( "detection time = %gms\n", t/((double)cvGetTickFrequency()*1000.) );//????????????????????

for( i = 0; i < (faces ? faces->total : 0); i++ )//?????????????????
{ //? total ?????????????????????????????i=face->total
CvRect* r = (CvRect*)cvGetSeqElem( faces, i );//CvRect?????????cvGetSeqElem( ??,?? )????????????
//????????????????,??????????r?
CvMat small_img_roi;
CvSeq* nested_objects;
CvPoint center;
CvScalar color = colors[i%8];
int radius;
center.x = cvRound((r->x + r->width*0.5)*scale);
center.y = cvRound((r->y + r->height*0.5)*scale);//center?????????
radius = cvRound((r->width + r->height)*0.25*scale);//?
cvCircle( img, center, radius, color, 3, 8, 0 );//????????
/* cvRectangle( img, cvPoint(r->x*scale,r->y*scale),
cvPoint((r->x+r->width)*scale,
(r->y+r->height)*scale),
CV_RGB(255,0,0), 3 );//??????*/

if( !nested_cascade )//???????????,???,??????
continue;
cvGetSubRect( small_img, &small_img_roi, *r );//??????????????????????
//?samll-img???r?????,??&small_img_roi?,???????????
nested_objects = cvHaarDetectObjects( &small_img_roi, nested_cascade, storage,//?&small_img_roi??nestedcascade????
1.1, 2, 0
//|CV_HAAR_FIND_BIGGEST_OBJECT
//|CV_HAAR_DO_ROUGH_SEARCH
//|CV_HAAR_DO_CANNY_PRUNING
//|CV_HAAR_SCALE_IMAGE
,
cvSize(0, 0)/*????00?*/ );
for( j = 0; j < (nested_objects ? nested_objects->total : 0); j++ )//????????????????????
{
CvRect* nr = (CvRect*)cvGetSeqElem( nested_objects, j );
center.x = cvRound((r->x + nr->x + nr->width*0.5)*scale);
center.y = cvRound((r->y + nr->y + nr->height*0.5)*scale);

radius = cvRound((nr->width + nr->height)*0.25*scale);

cvCircle( img, center, radius, color, 3, 8, 0 );
}
}
}
求解红色处这两个值怎么输出:center.x ,center.y 在控制台或者加一个label输出都行 能输出就行。
...全文
154 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
heykaokao 2012-11-02
  • 打赏
  • 举报
回复
我在上面的xy下面加上PRINTF 就能输出 下面就不行。为虾米呢
wjain 2012-10-29
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 的回复:]

引用 2 楼 的回复:
printf("[%d, %d]", center.x ,center.y);

不知道你用什么类型来保存坐标点的`~
int就是 %d
float就是 %f

这个我试过 不好用,完全不输出啊亲 控制台还是只显示detection time
[/Quote]

难道程序输出默认被重定向了?
你试试输出到文件`~
heykaokao 2012-10-29
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 的回复:]
printf("[%d, %d]", center.x ,center.y);

不知道你用什么类型来保存坐标点的`~
int就是 %d
float就是 %f
[/Quote]
这个我试过 不好用,完全不输出啊亲 控制台还是只显示detection time
赵4老师 2012-10-29
  • 打赏
  • 举报
回复
在每个最后不带\n的printf后面加fflush(stdout);

printf("[%d, %d]\n", center.x ,center.y);
或者
printf("[%d, %d]", center.x ,center.y);fflush(stdout);
Alexander 2012-10-29
  • 打赏
  • 举报
回复
center.x = cvRound((r->x + nr->x + nr->width*0.5)*scale);
center.y = cvRound((r->y + nr->y + nr->height*0.5)*scale);
printf("[%d, %d]", center.x ,center.y);
输不出东西?
Alexander 2012-10-29
  • 打赏
  • 举报
回复
话说LZ这段代码写在哪的?main?事件?
赵4老师 2012-10-29
  • 打赏
  • 举报
回复
重建所有
wjain 2012-10-26
  • 打赏
  • 举报
回复
printf("[%d, %d]", center.x ,center.y);

不知道你用什么类型来保存坐标点的`~
int就是 %d
float就是 %f
Jake443403168 2012-10-26
  • 打赏
  • 举报
回复
写log,MessageBox ?

69,371

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧