[英]How to get x and y cordinates separately to int from cvPoint?
From the following program, I need to find the x and y value of coordinates from the cvPoint value. 从以下程序中,我需要从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);
}
}
The circle is drawn using the points. 使用点绘制圆。 I need to get the x and y coordinates from the points.
我需要从点得到x和y坐标。 The defect array is created by
CvConvexityDefect* defectArray
. 缺陷数组由
CvConvexityDefect* defectArray
创建。
If name of your point object is myPoint , then you can access its x and y values as 如果您的点对象的名称是myPoint,那么您可以访问其x和y值
int x = myPoint.x ;
int y = myPoint.y ;
in your case you can write 在你的情况下你可以写
int x = *(defectArray[i].start).x ;
int y = *(defectArray[i].start).y ;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.