gpt4 book ai didi

c++ - 如何从 cvPoint 中分别获取 x 和 y 坐标到 int?

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:20:39 25 4
gpt4 key购买 nike

在下面的程序中,我需要从 cvPoint 值中找到坐标的 x 和 y 值。

for(int i=0; i<nomdef; i++)  
{
if(defectArray[i].depth > 40 )
{
con=con+1;

cvLine(src, *(defectArray[i].start), *(defectArray[i].depth_point),CV_RGB(255,255,0),1, CV_AA, 0 );
cvCircle(src, *(defectArray[i].depth_point), 5, CV_RGB(0,0,255), 2, 8,0);
cvCircle(src, *(defectArray[i].start), 5, CV_RGB(0,255,0), 2, 8,0);
cvLine(src, *(defectArray[i].depth_point), *(defectArray[i].end),CV_RGB(0,255,255),1, CV_AA, 0 );
cvDrawContours(src,defects,CV_RGB(0,0,0),CV_RGB(255,0,0),-1,CV_FILLED,8);
}
}

圆是用点画的。我需要从点中获取 x 和 y 坐标。缺陷数组由 CvConvexityDefect* defectArray 创建。

最佳答案

如果您的点对象的名称是 myPoint ,那么您可以访问它的 x 和 y 值作为

int x = myPoint.x ;
int y = myPoint.y ;

在你的情况下你可以写

int x = *(defectArray[i].start).x ; 
int y = *(defectArray[i].start).y ;

关于c++ - 如何从 cvPoint 中分别获取 x 和 y 坐标到 int?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43509419/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com