コード例 #1
0
ファイル: CvInvoke.cs プロジェクト: sanglin307/UnityOpenCV
 public static extern int cvFindFundamentalMat(IntPtr points1, IntPtr points2, IntPtr fundamental_matrix, FundamentalMatMethod method,
     double param1, double param2, IntPtr status);
コード例 #2
0
ファイル: Cv2_calib3d.cs プロジェクト: kaorun55/opencvsharp
        /// <summary>
        /// Calculates a fundamental matrix from the corresponding points in two images.
        /// </summary>
        /// <param name="points1">Array of N points from the first image. 
        /// The point coordinates should be floating-point (single or double precision).</param>
        /// <param name="points2">Array of the second image points of the same size and format as points1 .</param>
        /// <param name="method">Method for computing a fundamental matrix.</param>
        /// <param name="param1">Parameter used for RANSAC. 
        /// It is the maximum distance from a point to an epipolar line in pixels, beyond which the point is 
        /// considered an outlier and is not used for computing the final fundamental matrix. It can be set to 
        /// something like 1-3, depending on the accuracy of the point localization, image resolution, and the image noise.</param>
        /// <param name="param2">Parameter used for the RANSAC or LMedS methods only. 
        /// It specifies a desirable level of confidence (probability) that the estimated matrix is correct.</param>
        /// <param name="mask">Output array of N elements, every element of which is set to 0 for outliers and 
        /// to 1 for the other points. The array is computed only in the RANSAC and LMedS methods. For other methods, it is set to all 1’s.</param>
        /// <returns>fundamental matrix</returns>
        public static Mat FindFundamentalMat(
            IEnumerable<Point2d> points1, IEnumerable<Point2d> points2,
            FundamentalMatMethod method = FundamentalMatMethod.Ransac,
            double param1 = 3.0, double param2 = 0.99,
            OutputArray mask = null)
        {
            if (points1 == null)
                throw new ArgumentNullException("points1");
            if (points2 == null)
                throw new ArgumentNullException("points2");

            Point2d[] points1Array = EnumerableEx.ToArray(points1);
            Point2d[] points2Array = EnumerableEx.ToArray(points2);

            IntPtr mat = NativeMethods.calib3d_findFundamentalMat_array(
                points1Array, points1Array.Length,
                points2Array, points2Array.Length, (int)method,
                param1, param2, ToPtr(mask));
            if (mask != null)
                mask.Fix();
            return new Mat(mat);
        }
コード例 #3
0
ファイル: Cv2_calib3d.cs プロジェクト: kaorun55/opencvsharp
        /// <summary>
        /// Calculates a fundamental matrix from the corresponding points in two images.
        /// </summary>
        /// <param name="points1">Array of N points from the first image. 
        /// The point coordinates should be floating-point (single or double precision).</param>
        /// <param name="points2">Array of the second image points of the same size and format as points1 .</param>
        /// <param name="method">Method for computing a fundamental matrix.</param>
        /// <param name="param1">Parameter used for RANSAC. 
        /// It is the maximum distance from a point to an epipolar line in pixels, beyond which the point is 
        /// considered an outlier and is not used for computing the final fundamental matrix. It can be set to 
        /// something like 1-3, depending on the accuracy of the point localization, image resolution, and the image noise.</param>
        /// <param name="param2">Parameter used for the RANSAC or LMedS methods only. 
        /// It specifies a desirable level of confidence (probability) that the estimated matrix is correct.</param>
        /// <param name="mask">Output array of N elements, every element of which is set to 0 for outliers and 
        /// to 1 for the other points. The array is computed only in the RANSAC and LMedS methods. For other methods, it is set to all 1’s.</param>
        /// <returns>fundamental matrix</returns>
        public static Mat FindFundamentalMat(
            InputArray points1, InputArray points2,
            FundamentalMatMethod method = FundamentalMatMethod.Ransac,
            double param1 = 3.0, double param2 = 0.99,
            OutputArray mask = null)
        {
            if (points1 == null)
                throw new ArgumentNullException("points1");
            if (points2 == null)
                throw new ArgumentNullException("points2");
            points1.ThrowIfDisposed();
            points2.ThrowIfDisposed();

            IntPtr mat = NativeMethods.calib3d_findFundamentalMat_InputArray(
                points1.CvPtr, points2.CvPtr, (int)method,
                param1, param2, ToPtr(mask));
            if (mask != null)
                mask.Fix();
            return new Mat(mat);
        }
コード例 #4
0
ファイル: Cv_F.cs プロジェクト: jorik041/opencvsharp
        /// <summary>
        /// 2枚の画像間の点対応から基礎行列(F行列)を計算する
        /// </summary>
        /// <param name="points1">大きさが2xN, Nx2, 3xN,または Nx3 の1枚目の画像上の点の配列 (N は点の数).マルチチャンネルで大きさ 1xN,または Nx1 の配 列も使用可能である. 点の座標は浮動小数点型で表される(単精度または倍精度).</param>
        /// <param name="points2">2枚目の画像上の点の配列で point1とフォーマットやサイズは同じ.</param>
        /// <param name="fundamentalMatrix">出力される基礎行列.サイズは 3x3, または 9x3(7-point methodは3つの行列を返す).</param>
        /// <param name="method">基礎行列の計算手法</param>
        /// <param name="param1">RANSAC メソッドのときにのみ使用されるパラメータ.点からエピポーラ線までの最大距離(その距離を超えるものは外れ値であると判断し,それらを最終的な基礎行列の計算に使用しない)をピクセル単位で示す. 通常は 1~3 の値にセットされる. </param>
        /// <param name="param2">RANSAC または LMedSメソッドのときにのみ使用されるパラメータ. F行列の推定精度の信頼レベルを示す.</param>
        /// <param name="status">N個の要素からなる出力配列. 各要素は,アウトライア(外れ値)に対しては 0,「インライア」,つまり推定されたエピポーラ幾何に良く適合する値, に対しては 1 にセットされる. この配列は RANSAC または LMedS のときのみ計算される.他の手法では,すべて 1 にセットされる.</param>
        /// <returns>求めた基礎行列の数(1 または 3).もし行列が求まらないときは0.</returns>
#else
        /// <summary>
        /// Calculates fundamental matrix from corresponding points in two images
        /// </summary>
        /// <param name="points1">Array of the first image points of 2xN, Nx2, 3xN or Nx3 size (where N is number of points). Multi-channel 1xN or Nx1 array is also acceptable. The point coordinates should be floating-point (single or double precision) </param>
        /// <param name="points2">Array of the second image points of the same size and format as points1</param>
        /// <param name="fundamentalMatrix">The output fundamental matrix or matrices. The size should be 3x3 or 9x3 (7-point method may return up to 3 matrices). </param>
        /// <param name="method">Method for computing the fundamental matrix </param>
        /// <param name="param1">The parameter is used for RANSAC method only. It is the maximum distance from point to epipolar line in pixels, beyond which the point is considered an outlier and is not used for computing the final fundamental matrix. Usually it is set somewhere from 1 to 3. </param>
        /// <param name="param2">The parameter is used for RANSAC or LMedS methods only. It denotes the desirable level of confidence of the fundamental matrix estimate. </param>
        /// <param name="status">The optional output array of N elements, every element of which is set to 0 for outliers and to 1 for the "inliers", i.e. points that comply well with the estimated epipolar geometry. The array is computed only in RANSAC and LMedS methods. For other methods it is set to all 1’s. </param>
        /// <returns></returns>
#endif
        public static int FindFundamentalMat(CvMat points1, CvMat points2, CvMat fundamentalMatrix, FundamentalMatMethod method, double param1, double param2, CvMat status)
        {
            if (points1 == null)
                throw new ArgumentNullException("points1");
            if (points2 == null)
                throw new ArgumentNullException("points2");
            if (fundamentalMatrix == null)
                throw new ArgumentNullException("fundamentalMatrix");
            IntPtr statusPtr = (status == null) ? IntPtr.Zero : status.CvPtr;
            return NativeMethods.cvFindFundamentalMat(points1.CvPtr, points2.CvPtr, fundamentalMatrix.CvPtr, method, param1, param2, statusPtr);
        }
コード例 #5
0
ファイル: Cv_F.cs プロジェクト: jorik041/opencvsharp
        /// <summary>
        /// 2枚の画像間の点対応から基礎行列(F行列)を計算する
        /// </summary>
        /// <param name="points1">大きさが2xN, Nx2, 3xN,または Nx3 の1枚目の画像上の点の配列 (N は点の数).マルチチャンネルで大きさ 1xN,または Nx1 の配 列も使用可能である. 点の座標は浮動小数点型で表される(単精度または倍精度).</param>
        /// <param name="points2">2枚目の画像上の点の配列で point1とフォーマットやサイズは同じ.</param>
        /// <param name="fundamentalMatrix">出力される基礎行列.サイズは 3x3, または 9x3(7-point methodは3つの行列を返す).</param>
        /// <param name="method">基礎行列の計算手法</param>
        /// <param name="param1">RANSAC メソッドのときにのみ使用されるパラメータ.点からエピポーラ線までの最大距離(その距離を超えるものは外れ値であると判断し,それらを最終的な基礎行列の計算に使用しない)をピクセル単位で示す. 通常は 1~3 の値にセットされる. </param>
        /// <param name="param2">RANSAC または LMedSメソッドのときにのみ使用されるパラメータ. F行列の推定精度の信頼レベルを示す.</param>
        /// <returns>求めた基礎行列の数(1 または 3).もし行列が求まらないときは0.</returns>
#else
        /// <summary>
        /// Calculates fundamental matrix from corresponding points in two images
        /// </summary>
        /// <param name="points1">Array of the first image points of 2xN, Nx2, 3xN or Nx3 size (where N is number of points). Multi-channel 1xN or Nx1 array is also acceptable. The point coordinates should be floating-point (single or double precision) </param>
        /// <param name="points2">Array of the second image points of the same size and format as points1</param>
        /// <param name="fundamentalMatrix">The output fundamental matrix or matrices. The size should be 3x3 or 9x3 (7-point method may return up to 3 matrices). </param>
        /// <param name="method">Method for computing the fundamental matrix </param>
        /// <param name="param1">The parameter is used for RANSAC method only. It is the maximum distance from point to epipolar line in pixels, beyond which the point is considered an outlier and is not used for computing the final fundamental matrix. Usually it is set somewhere from 1 to 3. </param>
        /// <param name="param2">The parameter is used for RANSAC or LMedS methods only. It denotes the desirable level of confidence of the fundamental matrix estimate. </param>
        /// <returns></returns>
#endif
        public static int FindFundamentalMat(CvMat points1, CvMat points2, CvMat fundamentalMatrix, FundamentalMatMethod method, double param1, double param2)
        {
            return FindFundamentalMat(points1, points2, fundamentalMatrix, method, param1, param2, null);
        }
コード例 #6
0
ファイル: Cv_F.cs プロジェクト: jorik041/opencvsharp
        /// <summary>
        /// 2枚の画像間の点対応から基礎行列(F行列)を計算する
        /// </summary>
        /// <param name="points1">大きさが2xN, Nx2, 3xN,または Nx3 の1枚目の画像上の点の配列 (N は点の数).マルチチャンネルで大きさ 1xN,または Nx1 の配 列も使用可能である. 点の座標は浮動小数点型で表される(単精度または倍精度).</param>
        /// <param name="points2">2枚目の画像上の点の配列で point1とフォーマットやサイズは同じ.</param>
        /// <param name="fundamentalMatrix">出力される基礎行列.サイズは 3x3, または 9x3(7-point methodは3つの行列を返す).</param>
        /// <param name="method">基礎行列の計算手法</param>
        /// <returns>求めた基礎行列の数(1 または 3).もし行列が求まらないときは0.</returns>
#else
        /// <summary>
        /// Calculates fundamental matrix from corresponding points in two images
        /// </summary>
        /// <param name="points1">Array of the first image points of 2xN, Nx2, 3xN or Nx3 size (where N is number of points). Multi-channel 1xN or Nx1 array is also acceptable. The point coordinates should be floating-point (single or double precision) </param>
        /// <param name="points2">Array of the second image points of the same size and format as points1</param>
        /// <param name="fundamentalMatrix">The output fundamental matrix or matrices. The size should be 3x3 or 9x3 (7-point method may return up to 3 matrices). </param>
        /// <param name="method">Method for computing the fundamental matrix </param>
        /// <returns></returns>
#endif
        public static int FindFundamentalMat(CvMat points1, CvMat points2, CvMat fundamentalMatrix, FundamentalMatMethod method)
        {
            return FindFundamentalMat(points1, points2, fundamentalMatrix, method, 3.0, 0.99, null);
        }