0

convexitydefect()Java 言語の関数に関する情報が必要です。

これは機能です:

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

結果は、convexityDefects 変数にあります。

MatOfInt4 convexityDefects;

現在、c++ では、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; 

しかし、Java は行に対して 4 int を返します! javaでstart、end、depth_point、depthに関する情報を取得するにはどうすればよいですか?

4

1 に答える 1

0

convexityDefectsあなたが言及した構造は、C API専用です。C++ と Java の場合、ドキュメントに既に記載されている以上の答えを出すのは困難です。

C++ および新しい Python/Java インターフェイスでは、各凸性欠陥は 4 要素の整数ベクトル (別名cv::Vec4i): ( start_indexend_indexfarthest_pt_indexfixpt_depth) として表されます。ここで、インデックスは、凸性欠陥の開始、終了、および最も遠いポイントでありfixpt_depth、最も遠いコンター ポイントとハルの間の距離の固定小数点近似 (小数部 8 ビット) です。つまり、深さの浮動小数点値を取得するには になりますfixpt_depth/256.0

したがって、startendは 4 の最初の 2 つの要素であり、intへのインデックスを含みますcontourdepth_pointは 3 番目の要素であり、 の最も深い点のインデックスですcontour。最後の要素を 256 で割り、深さの浮動小数点値を取得します。

于 2013-08-26T23:48:50.133 に答える