2017-04-20 8 views
1

다음 프로그램에서 cvPoint 값에서 좌표의 x 및 y 값을 찾아야합니다.cvPoint에서 x 및 y 좌표를 int로 개별적으로 가져 오는 방법은 무엇입니까?

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에 의해 생성됩니다.

답변

0

요점 개체의 이름이 myPoint 경우, 당신은 당신이 멤버에 대한

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

요청을 쓸 수 있습니다 귀하의 경우

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

로 '에'X '를 x 및 y 값에 액세스 할 수 있습니다 'CvPoint *'포인터 유형의 (CvConvexityDefect :: start) '(어쩌면 당신은'-> '를 사용하려고 했나요?) int x1 = * (defectArray [1] .start) .x; 나는 그것에 대해 오류가 있었는데 .. 어떻게해야합니까? –