From the following program, I need to find the x and y value of coordinates from the cvPoint value.
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. The defect array is created by CvConvexityDefect* defectArray
.
If name of your point object is myPoint , then you can access its x and y values as
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 ;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.