2013-08-25 4 views
0

Java 언어로 된 convexitydefect() 함수에 대한 정보가 필요합니다. convexityDefects의 구조체가Imgproc.convexityDefects(); Eclipse + java + opencv에서

C에서 이제
MatOfInt4 convexityDefects; 

++ :

Imgproc.convexityDefects(MatOfPoint contour, MatOfInt convexhull, MatOfInt4 convexityDefects) 

결과는 convexityDefects 변수에 :

는 기능입니다

CvPoint* start; // point of the contour where the defect begins 

CvPoint* end; // point of the contour where the defect ends 

CvPoint* depth_point; // the farthest from the convex hull point within the defect 

float depth; 

그러나 자바는 4 retunrs int for row! Java에서 시작, 끝, 깊이 _ 점, 깊이에 대한 정보를 어떻게 얻을 수 있습니까?

답변

0

언급 한 convexityDefects 구조는 C API 전용입니다. C++ 및 Java의 경우, 이미 documentation보다 더 나은 답변을하기 어렵다 있습니다

C에서

++ 및 새로운 파이썬/자바 인터페이스는 각 볼록 결함이 4 요소 정수 벡터 (일명 cv::Vec4i)으로 표현된다 : (start_index, end_index, farthest_pt_index, fixpt_depth) 여기서 인덱스는 볼록 결함 시작, 끝 및 가장 먼 지점의 원래 윤곽에서 0 기준 인덱스이며 fixpt_depth은 가장 먼 윤곽선 사이의 거리의 고정 소수점 근사 (8 소수 비트 포함)입니다. 포인트와 선체. 즉, 깊이의 부동 소수점 값을 얻으려면 fixpt_depth/256.0이됩니다.

따라서, startendint 4 개 (S)의 처음 두 요소 및 contour의 인덱스를 포함한다. depth_point은 세 번째 요소이며 가장 깊은 점의 인덱스는 contour입니다. 마지막 요소를 256으로 나누어 심도의 부동 소수점 값을 가져옵니다.