opencv java apiを使用して、次の質問のサンプルコードを実装しようとしています
。Javaで実装するためfindContours(gray, contours, CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE);に、私はこの構文を使用しましImgproc.findContours(gray, contours, new Mat(), Imgproc.RETR_LIST, Imgproc.CHAIN_APPROX_SIMPLE);た。
したがって、輪郭はでList<MatOfPoint> contours = new ArrayList<MatOfPoint>();はなくになりvector<vector<cv::Point> > contours;ます。
次に、これを実装する必要がありますapproxPolyDP(Mat(contours[i]), approx, arcLength(Mat(contours[i]), true)*0.02, true);。Java APIでは、Imgproc.approxPolyDPは引数をとして受け入れますapproxPolyDP(MatOfPoint2f curve, MatOfPoint2f approxCurve, double epsilon, boolean closed)。MatOfPointをMatOfPoint2fに変換するにはどうすればよいですか?
または、これを実装するためにc++インターフェイスと同じベクトルを使用する方法はありますか。提案やサンプルコードは大歓迎です。