/// <summary> /// 指定した精度でポリラインを近似する /// </summary> /// <param name="headerSize">近似されたポリラインのヘッダサイズ.</param> /// <param name="storage">近似された輪郭の保存場所.nullの場合,入力シーケンスのストレージが使われる. </param> /// <param name="method">近似方法</param> /// <param name="parameter">近似方法に依存するパラメータ.CV_POLY_APPROX_DPの場合には,要求する近似精度である.</param> /// <param name="parameter2">src_seqが点の配列(CvMat)の場合, このパラメータは輪郭が閉じている(parameter2=true)か,開いているか(parameter2=false)を指定する.</param> /// <returns>単一もしくは複数の近似曲線を計算した結果</returns> #else /// <summary> /// Approximates polygonal curve(s) with desired precision. /// </summary> /// <param name="headerSize">Header size of approximated curve[s]. </param> /// <param name="storage">Container for approximated contours. If it is null, the input sequences' storage is used. </param> /// <param name="method">Approximation method; only ApproxPolyMethod.DP is supported, that corresponds to Douglas-Peucker algorithm. </param> /// <param name="parameter">Method-specific parameter; in case of CV_POLY_APPROX_DP it is a desired approximation accuracy. </param> /// <param name="parameter2">If case if src_seq is sequence it means whether the single sequence should be approximated /// or all sequences on the same level or below src_seq (see cvFindContours for description of hierarchical contour structures). /// And if src_seq is array (CvMat*) of points, the parameter specifies whether the curve is closed (parameter2==true) or not (parameter2==false). </param> /// <returns></returns> #endif public CvSeq <CvPoint> ApproxPoly(int headerSize, CvMemStorage storage, ApproxPolyMethod method, double parameter, bool parameter2) { if (typeof(T) == typeof(CvPoint)) { return(Cv.ApproxPoly((CvSeq <CvPoint>)(object) this, headerSize, storage, method, parameter, parameter2)); } else { throw new InvalidOperationException("This instance must be CvSeq<CvPoint>"); } }
/// <summary> /// 指定した精度でポリラインを近似する /// </summary> /// <param name="srcSeq">点のシーケンスまたは配列</param> /// <param name="headerSize">近似されたポリラインのヘッダサイズ.</param> /// <param name="storage">近似された輪郭の保存場所.nullの場合,入力シーケンスのストレージが使われる. </param> /// <param name="method">近似方法</param> /// <param name="parameter">近似方法に依存するパラメータ.CV_POLY_APPROX_DPの場合には,要求する近似精度である.</param> /// <param name="parameter2">src_seqが点の配列(CvMat)の場合, このパラメータは輪郭が閉じている(parameter2=true)か,開いているか(parameter2=false)を指定する.</param> /// <returns>単一もしくは複数の近似曲線を計算した結果</returns> #else /// <summary> /// Approximates polygonal curve(s) with desired precision. /// </summary> /// <param name="srcSeq">Sequence of array of points. </param> /// <param name="headerSize">Header size of approximated curve[s]. </param> /// <param name="storage">Container for approximated contours. If it is null, the input sequences' storage is used. </param> /// <param name="method">Approximation method; only ApproxPolyMethod.DP is supported, that corresponds to Douglas-Peucker algorithm. </param> /// <param name="parameter">Method-specific parameter; in case of CV_POLY_APPROX_DP it is a desired approximation accuracy. </param> /// <param name="parameter2">If case if src_seq is sequence it means whether the single sequence should be approximated /// or all sequences on the same level or below src_seq (see cvFindContours for description of hierarchical contour structures). /// And if src_seq is array (CvMat*) of points, the parameter specifies whether the curve is closed (parameter2==true) or not (parameter2==false). </param> /// <returns></returns> #endif public static CvSeq <CvPoint> ApproxPoly(CvSeq <CvPoint> srcSeq, int headerSize, CvMemStorage storage, ApproxPolyMethod method, double parameter, bool parameter2) { if (srcSeq == null) { throw new ArgumentNullException(nameof(srcSeq)); } IntPtr result = NativeMethods.cvApproxPoly(srcSeq.CvPtr, headerSize, ToPtr(storage), method, parameter, parameter2); if (result == IntPtr.Zero) { return(null); } GC.KeepAlive(srcSeq); GC.KeepAlive(storage); return(new CvSeq <CvPoint>(result)); }
/// <summary> /// 指定した精度でポリラインを近似する /// </summary> /// <param name="srcSeq">点のシーケンスまたは配列</param> /// <param name="headerSize">近似されたポリラインのヘッダサイズ.</param> /// <param name="storage">近似された輪郭の保存場所.nullの場合,入力シーケンスのストレージが使われる. </param> /// <param name="method">近似方法</param> /// <param name="parameter">近似方法に依存するパラメータ.CV_POLY_APPROX_DPの場合には,要求する近似精度である.</param> /// <returns>単一もしくは複数の近似曲線を計算した結果</returns> #else /// <summary> /// Approximates polygonal curve(s) with desired precision. /// </summary> /// <param name="srcSeq">Sequence of array of points. </param> /// <param name="headerSize">Header size of approximated curve[s]. </param> /// <param name="storage">Container for approximated contours. If it is null, the input sequences' storage is used. </param> /// <param name="method">Approximation method; only ApproxPolyMethod.DP is supported, that corresponds to Douglas-Peucker algorithm. </param> /// <param name="parameter">Method-specific parameter; in case of CV_POLY_APPROX_DP it is a desired approximation accuracy. </param> /// <returns></returns> #endif public static CvSeq <CvPoint> ApproxPoly(CvSeq <CvPoint> srcSeq, int headerSize, CvMemStorage storage, ApproxPolyMethod method, double parameter) { return(ApproxPoly(srcSeq, headerSize, storage, method, parameter, false)); }
public static extern IntPtr cvApproxPoly(IntPtr src_seq, int header_size, IntPtr storage, ApproxPolyMethod method, double parameter, [MarshalAs(UnmanagedType.Bool)] bool parameter2);
/// <summary> /// 指定した精度でポリラインを近似する /// </summary> /// <param name="srcSeq">点のシーケンスまたは配列</param> /// <param name="headerSize">近似されたポリラインのヘッダサイズ.</param> /// <param name="storage">近似された輪郭の保存場所.nullの場合,入力シーケンスのストレージが使われる. </param> /// <param name="method">近似方法</param> /// <param name="parameter">近似方法に依存するパラメータ.CV_POLY_APPROX_DPの場合には,要求する近似精度である.</param> /// <param name="parameter2">src_seqが点の配列(CvMat)の場合, このパラメータは輪郭が閉じている(parameter2=true)か,開いているか(parameter2=false)を指定する.</param> /// <returns>単一もしくは複数の近似曲線を計算した結果</returns> #else /// <summary> /// Approximates polygonal curve(s) with desired precision. /// </summary> /// <param name="srcSeq">Sequence of array of points. </param> /// <param name="headerSize">Header size of approximated curve[s]. </param> /// <param name="storage">Container for approximated contours. If it is null, the input sequences' storage is used. </param> /// <param name="method">Approximation method; only ApproxPolyMethod.DP is supported, that corresponds to Douglas-Peucker algorithm. </param> /// <param name="parameter">Method-specific parameter; in case of CV_POLY_APPROX_DP it is a desired approximation accuracy. </param> /// <param name="parameter2">If case if src_seq is sequence it means whether the single sequence should be approximated /// or all sequences on the same level or below src_seq (see cvFindContours for description of hierarchical contour structures). /// And if src_seq is array (CvMat*) of points, the parameter specifies whether the curve is closed (parameter2==true) or not (parameter2==false). </param> /// <returns></returns> #endif public static CvSeq <CvPoint> ApproxPoly(CvSeq <CvPoint> srcSeq, int headerSize, CvMemStorage storage, ApproxPolyMethod method, double parameter, bool parameter2) { if (srcSeq == null) { throw new ArgumentNullException("srcSeq"); } IntPtr storagePtr = (storage == null) ? IntPtr.Zero : storage.CvPtr; IntPtr result = NativeMethods.cvApproxPoly(srcSeq.CvPtr, headerSize, storagePtr, method, parameter, parameter2); if (result == IntPtr.Zero) { return(null); } return(new CvSeq <CvPoint>(result)); }
/// <summary> /// 指定した精度でポリラインを近似する /// </summary> /// <param name="srcSeq">点のシーケンスまたは配列</param> /// <param name="headerSize">近似されたポリラインのヘッダサイズ.</param> /// <param name="storage">近似された輪郭の保存場所.nullの場合,入力シーケンスのストレージが使われる. </param> /// <param name="method">近似方法</param> /// <param name="parameter">近似方法に依存するパラメータ.CV_POLY_APPROX_DPの場合には,要求する近似精度である.</param> /// <param name="parameter2">src_seqが点の配列(CvMat)の場合, このパラメータは輪郭が閉じている(parameter2=true)か,開いているか(parameter2=false)を指定する.</param> /// <returns>単一もしくは複数の近似曲線を計算した結果</returns> #else /// <summary> /// Approximates polygonal curve(s) with desired precision. /// </summary> /// <param name="srcSeq">Sequence of array of points. </param> /// <param name="headerSize">Header size of approximated curve[s]. </param> /// <param name="storage">Container for approximated contours. If it is null, the input sequences' storage is used. </param> /// <param name="method">Approximation method; only ApproxPolyMethod.DP is supported, that corresponds to Douglas-Peucker algorithm. </param> /// <param name="parameter">Method-specific parameter; in case of CV_POLY_APPROX_DP it is a desired approximation accuracy. </param> /// <param name="parameter2">If case if src_seq is sequence it means whether the single sequence should be approximated /// or all sequences on the same level or below src_seq (see cvFindContours for description of hierarchical contour structures). /// And if src_seq is array (CvMat*) of points, the parameter specifies whether the curve is closed (parameter2==true) or not (parameter2==false). </param> /// <returns></returns> #endif public static CvSeq<CvPoint> ApproxPoly(CvSeq<CvPoint> srcSeq, int headerSize, CvMemStorage storage, ApproxPolyMethod method, double parameter, bool parameter2) { if (srcSeq == null) { throw new ArgumentNullException("srcSeq"); } IntPtr storagePtr = (storage == null) ? IntPtr.Zero : storage.CvPtr; IntPtr result = NativeMethods.cvApproxPoly(srcSeq.CvPtr, headerSize, storagePtr, method, parameter, parameter2); if (result == IntPtr.Zero) return null; return new CvSeq<CvPoint>(result); }
/// <summary> /// 指定した精度でポリラインを近似する /// </summary> /// <param name="srcSeq">点のシーケンスまたは配列</param> /// <param name="headerSize">近似されたポリラインのヘッダサイズ.</param> /// <param name="storage">近似された輪郭の保存場所.nullの場合,入力シーケンスのストレージが使われる. </param> /// <param name="method">近似方法</param> /// <param name="parameter">近似方法に依存するパラメータ.CV_POLY_APPROX_DPの場合には,要求する近似精度である.</param> /// <returns>単一もしくは複数の近似曲線を計算した結果</returns> #else /// <summary> /// Approximates polygonal curve(s) with desired precision. /// </summary> /// <param name="srcSeq">Sequence of array of points. </param> /// <param name="headerSize">Header size of approximated curve[s]. </param> /// <param name="storage">Container for approximated contours. If it is null, the input sequences' storage is used. </param> /// <param name="method">Approximation method; only ApproxPolyMethod.DP is supported, that corresponds to Douglas-Peucker algorithm. </param> /// <param name="parameter">Method-specific parameter; in case of CV_POLY_APPROX_DP it is a desired approximation accuracy. </param> /// <returns></returns> #endif public static CvSeq<CvPoint> ApproxPoly(CvSeq<CvPoint> srcSeq, int headerSize, CvMemStorage storage, ApproxPolyMethod method, double parameter) { return ApproxPoly(srcSeq, headerSize, storage, method, parameter, false); }
/// <summary> /// 指定した精度でポリラインを近似する /// </summary> /// <param name="srcSeq">点のシーケンスまたは配列</param> /// <param name="headerSize">近似されたポリラインのヘッダサイズ.</param> /// <param name="storage">近似された輪郭の保存場所.nullの場合,入力シーケンスのストレージが使われる. </param> /// <param name="method">近似方法</param> /// <param name="parameter">近似方法に依存するパラメータ.CV_POLY_APPROX_DPの場合には,要求する近似精度である.</param> /// <param name="parameter2">src_seqが点の配列(CvMat)の場合, このパラメータは輪郭が閉じている(parameter2=true)か,開いているか(parameter2=false)を指定する.</param> /// <returns>単一もしくは複数の近似曲線を計算した結果</returns> #else /// <summary> /// Approximates polygonal curve(s) with desired precision. /// </summary> /// <param name="srcSeq">Sequence of array of points. </param> /// <param name="headerSize">Header size of approximated curve[s]. </param> /// <param name="storage">Container for approximated contours. If it is null, the input sequences' storage is used. </param> /// <param name="method">Approximation method; only ApproxPolyMethod.DP is supported, that corresponds to Douglas-Peucker algorithm. </param> /// <param name="parameter">Method-specific parameter; in case of CV_POLY_APPROX_DP it is a desired approximation accuracy. </param> /// <param name="parameter2">If case if src_seq is sequence it means whether the single sequence should be approximated /// or all sequences on the same level or below src_seq (see cvFindContours for description of hierarchical contour structures). /// And if src_seq is array (CvMat*) of points, the parameter specifies whether the curve is closed (parameter2==true) or not (parameter2==false). </param> /// <returns></returns> #endif public static CvSeq<CvPoint> ApproxPoly(CvSeq<CvPoint> srcSeq, int headerSize, CvMemStorage storage, ApproxPolyMethod method, double parameter, bool parameter2) { if (srcSeq == null) throw new ArgumentNullException("srcSeq"); IntPtr result = NativeMethods.cvApproxPoly(srcSeq.CvPtr, headerSize, ToPtr(storage), method, parameter, parameter2); if (result == IntPtr.Zero) return null; GC.KeepAlive(srcSeq); GC.KeepAlive(storage); return new CvSeq<CvPoint>(result); }