/// <summary> /// /// </summary> /// <param name="rowRange"></param> /// <param name="colRange"></param> /// <returns></returns> public virtual Mat this[CvSlice rowRange, CvSlice colRange] { get { Mat result = new Mat(); GpuInvoke.GpuMat_opRange2(ptr, rowRange, colRange, result.CvPtr); return(result); } }
/// <summary> /// /// </summary> /// <param name="m"></param> /// <param name="rowRange"></param> /// <param name="colRange"></param> public GpuMat(GpuMat m, CvSlice rowRange, CvSlice colRange) { if (m == null) { throw new ArgumentNullException("m"); } ptr = GpuInvoke.GpuMat_new9(m.CvPtr, rowRange, colRange); if (ptr == IntPtr.Zero) { throw new OpenCvSharpException(); } }
/// <summary> /// 入力サンプルに対する応答を予測する /// </summary> /// <param name="sample">入力サンプル</param> /// <param name="missing">データ欠損マスク(オプション).データ欠損を扱うためには,弱い決定木が代理分岐を含まなければならない.</param> /// <param name="slice">予測に用いられる弱い決定木シーケンスの連続的部分集合(スライス).デフォルトでは,全ての弱い分類器が用いられる.</param> /// <param name="rawMode">falseは通常の入力を意味する.true の場合,このメソッドは離散入力変数の全ての値があらかじめ, 0..<num_of_categories_i>-1 の範囲に正規化されていることを仮定する(決定木は内部的にはこのような正規化された表現を用いている).これは決定木集合の高速な予測に役立つ.連続変数の入力変数に対しては,このフラグは利用されない.</param> /// <param name="returnSum"></param> /// <returns>重み付き投票に基づく出力クラスラベル</returns> #else /// <summary> /// Predicts response for the input sample /// </summary> /// <param name="sample">The input sample. </param> /// <param name="missing">The optional mask of missing measurements. To handle missing measurements, the weak classifiers must include surrogate splits. </param> /// <param name="slice">The continuous subset of the sequence of weak classifiers to be used for prediction. By default, all the weak classifiers are used. </param> /// <param name="rawMode">The last parameter is normally set to false that implies a regular input. If it is true, the method assumes that all the values of the discrete input variables have been already normalized to 0..<num_of_categoriesi>-1 ranges. (as the decision tree uses such normalized representation internally). It is useful for faster prediction with tree ensembles. For ordered input variables the flag is not used. </param> /// <param name="returnSum"></param> /// <returns>the output class label based on the weighted voting. </returns> #endif public float Predict( Mat sample, Mat missing = null, Range?slice = null, bool rawMode = false, bool returnSum = false) { if (sample == null) { throw new ArgumentNullException("sample"); } CvSlice slice0 = slice.GetValueOrDefault(CvSlice.WholeSeq); return(NativeMethods.ml_CvBoost_predict_Mat( ptr, sample.CvPtr, Cv2.ToPtr(missing), slice0, rawMode ? 1 : 0, returnSum ? 1 : 0)); }
/// <summary> /// 入力サンプルに対する応答を予測する /// </summary> /// <param name="sample">入力サンプル</param> /// <param name="missing">データ欠損マスク(オプション).データ欠損を扱うためには,弱い決定木が代理分岐を含まなければならない.</param> /// <param name="weakResponses">個々の弱い決定木からの応答の出力パラメータ(オプション)で,これは浮動小数点型ベクトルである.ベクトルの要素数は,slice 長と等しくなければならない.</param> /// <param name="slice">予測に用いられる弱い決定木シーケンスの連続的部分集合(スライス).デフォルトでは,全ての弱い分類器が用いられる.</param> /// <param name="rawMode">falseは通常の入力を意味する.true の場合,このメソッドは離散入力変数の全ての値があらかじめ, 0..<num_of_categories_i>-1 の範囲に正規化されていることを仮定する(決定木は内部的にはこのような正規化された表現を用いている).これは決定木集合の高速な予測に役立つ.連続変数の入力変数に対しては,このフラグは利用されない.</param> /// <param name="returnSum"></param> /// <returns>重み付き投票に基づく出力クラスラベル</returns> #else /// <summary> /// Predicts response for the input sample /// </summary> /// <param name="sample">The input sample. </param> /// <param name="missing">The optional mask of missing measurements. To handle missing measurements, the weak classifiers must include surrogate splits. </param> /// <param name="weakResponses">The optional output parameter, a floating-point vector, of responses from each individual weak classifier. The number of elements in the vector must be equal to the slice length. </param> /// <param name="slice">The continuous subset of the sequence of weak classifiers to be used for prediction. By default, all the weak classifiers are used. </param> /// <param name="rawMode">The last parameter is normally set to false that implies a regular input. If it is true, the method assumes that all the values of the discrete input variables have been already normalized to 0..<num_of_categoriesi>-1 ranges. (as the decision tree uses such normalized representation internally). It is useful for faster prediction with tree ensembles. For ordered input variables the flag is not used. </param> /// <param name="returnSum"></param> /// <returns>the output class label based on the weighted voting. </returns> #endif public float Predict( CvMat sample, CvMat missing = null, CvMat weakResponses = null, CvSlice?slice = null, bool rawMode = false, bool returnSum = false) { if (sample == null) { throw new ArgumentNullException(nameof(sample)); } CvSlice slice0 = slice.GetValueOrDefault(CvSlice.WholeSeq); return(NativeMethods.ml_Boost_predict_CvMat( ptr, sample.CvPtr, Cv2.ToPtr(missing), Cv2.ToPtr(weakResponses), slice0, rawMode ? 1 : 0, returnSum ? 1 : 0)); }
public static extern void cvSeqRemoveSlice(IntPtr seq, CvSlice slice);
public static extern double cvContourArea(IntPtr contour, CvSlice slice);
public static extern void ml_CvBoost_prune(IntPtr obj, CvSlice slice);
public static extern IntPtr gpu_GpuMat_new9(IntPtr m, CvSlice rowRange, CvSlice colRange);
public static extern void GpuMat_opRange2(IntPtr src, CvSlice rowRange, CvSlice colRange, IntPtr dst);
public static extern float ml_CvBoost_predict_Mat( IntPtr obj, IntPtr sample, IntPtr missing, CvSlice slice, int rawMode, int returnSum);
public static extern IntPtr core_Mat_new(IntPtr mat, CvSlice rowRange);
public static extern float CvBoost_predict(IntPtr obj, IntPtr _sample, IntPtr _missing, IntPtr weak_responses, CvSlice slice, bool raw_mode);
public static extern float ml_Boost_predict_CvMat( IntPtr obj, IntPtr sample, IntPtr missing, IntPtr weakResponses, CvSlice slice, int rawMode, int returnSum);
public static extern IntPtr cvSeqSlice(IntPtr seq, CvSlice slice, IntPtr storage, int copy_data);
public static extern IntPtr core_Mat_subMat(IntPtr self, int nRanges, CvSlice[] ranges);
public static extern int cvSliceLength(CvSlice slice, IntPtr seq);
/// <summary> /// 入力サンプルに対する応答を予測する /// </summary> /// <param name="sample">入力サンプル</param> /// <param name="missing">データ欠損マスク(オプション).データ欠損を扱うためには,弱い決定木が代理分岐を含まなければならない.</param> /// <param name="weak_responses">個々の弱い決定木からの応答の出力パラメータ(オプション)で,これは浮動小数点型ベクトルである.ベクトルの要素数は,slice 長と等しくなければならない.</param> /// <param name="slice">予測に用いられる弱い決定木シーケンスの連続的部分集合(スライス).デフォルトでは,全ての弱い分類器が用いられる.</param> /// <param name="raw_mode">falseは通常の入力を意味する.true の場合,このメソッドは離散入力変数の全ての値があらかじめ, 0..<num_of_categories_i>-1 の範囲に正規化されていることを仮定する(決定木は内部的にはこのような正規化された表現を用いている).これは決定木集合の高速な予測に役立つ.連続変数の入力変数に対しては,このフラグは利用されない.</param> /// <returns>重み付き投票に基づく出力クラスラベル</returns> #else /// <summary> /// Predicts response for the input sample /// </summary> /// <param name="sample">The input sample. </param> /// <param name="missing">The optional mask of missing measurements. To handle missing measurements, the weak classifiers must include surrogate splits. </param> /// <param name="weakResponses">The optional output parameter, a floating-point vector, of responses from each individual weak classifier. The number of elements in the vector must be equal to the slice length. </param> /// <param name="slice">The continuous subset of the sequence of weak classifiers to be used for prediction. By default, all the weak classifiers are used. </param> /// <param name="rawMode">The last parameter is normally set to false that implies a regular input. If it is true, the method assumes that all the values of the discrete input variables have been already normalized to 0..<num_of_categoriesi>-1 ranges. (as the decision tree uses such normalized representation internally). It is useful for faster prediction with tree ensembles. For ordered input variables the flag is not used. </param> /// <returns>the output class label based on the weighted voting. </returns> #endif public float Predict(CvMat sample, CvMat missing, CvMat weakResponses, CvSlice slice, bool rawMode) { if (sample == null) throw new ArgumentNullException("sample"); IntPtr missingPtr = (missing == null) ? IntPtr.Zero : missing.CvPtr; IntPtr weakResponsesPtr = (weakResponses == null) ? IntPtr.Zero : weakResponses.CvPtr; return MLInvoke.CvBoost_predict( ptr, sample.CvPtr, missingPtr, weakResponsesPtr, slice, rawMode ); }
/// <summary> /// returns a new matrix header for the specified row span /// </summary> /// <param name="r"></param> /// <returns></returns> public GpuMat RowRange(CvSlice r) { return(RowRange(r.StartIndex, r.EndIndex)); }
/// <summary> /// 輪郭の周囲長または曲線の長さを計算する /// </summary> /// <param name="curve">配列</param> /// <param name="slice">曲線の始点と終点.デフォルトでは曲線の全ての長さが計算される.</param> /// <param name="isClosed">閉曲線かどうかを示す.次の3つの状態がある: /// is_closed=0 - 曲線は閉曲線として扱われない. /// is_closed>0 - 曲線は閉曲線として扱われる. /// is_closed<0 - 曲線がシーケンスの場合, ((CvSeq*)curve)->flagsのフラグCV_SEQ_FLAG_CLOSEDから閉曲線かどうかを判別する.そうでない(曲線が点の配列(CvMat*)で表現される)場合,閉曲線として扱われない. /// </param> /// <returns>輪郭の周囲長または曲線の長さ</returns> #else /// <summary> /// Calculates contour perimeter or curve length /// </summary> /// <param name="curve">Sequence or array of the curve points. </param> /// <param name="slice">Starting and ending points of the curve, by default the whole curve length is calculated. </param> /// <param name="isClosed">Indicates whether the curve is closed or not. There are 3 cases: /// * is_closed=0 - the curve is assumed to be unclosed. /// * is_closed>0 - the curve is assumed to be closed. /// * is_closed<0 - if curve is sequence, the flag CV_SEQ_FLAG_CLOSED of ((CvSeq*)curve)->flags is checked to determine if the curve is closed or not, otherwise (curve is represented by array (CvMat*) of points) it is assumed to be unclosed. </param> /// <returns></returns> #endif public static double ArcLength(CvArr curve, CvSlice slice, int isClosed) { if (curve == null) throw new ArgumentNullException("curve"); double ret = NativeMethods.cvArcLength(curve.CvPtr, slice, isClosed); GC.KeepAlive(curve); return ret; }
/// <summary> /// returns a new matrix header for the specified column span /// </summary> /// <param name="r"></param> /// <returns></returns> public GpuMat ColRange(CvSlice r) { return(ColRange(r.StartIndex, r.EndIndex)); }
/// <summary> /// sub-array selection; only the header is copied /// </summary> /// <param name="ranges"></param> /// <returns></returns> public virtual MatND this[CvSlice[] ranges] { get { MatND result = new MatND(); CppInvoke.MatND_opRange(ptr, ranges, result.CvPtr); return result; } }
public static extern IntPtr GpuMat_new9(IntPtr m, CvSlice rowRange, CvSlice colRange);
public static extern IntPtr gpu_GpuMat_opRange2(IntPtr src, CvSlice rowRange, CvSlice colRange);
public static extern IntPtr Mat_new5(IntPtr m, CvSlice rowRange, CvSlice colRange);
public static extern double cvArcLength(IntPtr curve, CvSlice slice, int is_closed);
public static extern void MatND_opRange(IntPtr src, CvSlice[] ranges, IntPtr dst);
public static extern IntPtr cvCvtSeqToArray(IntPtr seq, IntPtr elements, CvSlice slice);
public static extern IntPtr cvSeqSlice(IntPtr seq, CvSlice slice, IntPtr storage, [MarshalAs(UnmanagedType.Bool)] bool copy_data);
/// <summary> /// 輪郭の周囲長または曲線の長さを計算する /// </summary> /// <param name="curve">配列</param> /// <param name="slice">曲線の始点と終点.デフォルトでは曲線の全ての長さが計算される.</param> /// <returns>輪郭の周囲長または曲線の長さ</returns> #else /// <summary> /// Calculates contour perimeter or curve length /// </summary> /// <param name="curve">Sequence or array of the curve points. </param> /// <param name="slice">Starting and ending points of the curve, by default the whole curve length is calculated. </param> /// <returns></returns> #endif public static double ArcLength(CvArr curve, CvSlice slice) { return ArcLength(curve, slice, -1); }
/// <summary> /// 入力サンプルに対する応答を予測する /// </summary> /// <param name="sample">入力サンプル</param> /// <param name="missing">データ欠損マスク(オプション).データ欠損を扱うためには,弱い決定木が代理分岐を含まなければならない.</param> /// <param name="weak_responses">個々の弱い決定木からの応答の出力パラメータ(オプション)で,これは浮動小数点型ベクトルである.ベクトルの要素数は,slice 長と等しくなければならない.</param> /// <param name="slice">予測に用いられる弱い決定木シーケンスの連続的部分集合(スライス).デフォルトでは,全ての弱い分類器が用いられる.</param> /// <returns>重み付き投票に基づく出力クラスラベル</returns> #else /// <summary> /// Predicts response for the input sample /// </summary> /// <param name="sample">The input sample. </param> /// <param name="missing">The optional mask of missing measurements. To handle missing measurements, the weak classifiers must include surrogate splits. </param> /// <param name="weakResponses">The optional output parameter, a floating-point vector, of responses from each individual weak classifier. The number of elements in the vector must be equal to the slice length. </param> /// <param name="slice">The continuous subset of the sequence of weak classifiers to be used for prediction. By default, all the weak classifiers are used. </param> /// <returns>the output class label based on the weighted voting. </returns> #endif public float Predict(CvMat sample, CvMat missing, CvMat weakResponses, CvSlice slice) { return Predict(sample, missing, weakResponses, slice, false); }
/// <summary> /// 輪郭の周囲長または曲線の長さを計算する /// </summary> /// <param name="curve">配列</param> /// <param name="slice">曲線の始点と終点.デフォルトでは曲線の全ての長さが計算される.</param> /// <param name="isClosed">閉曲線かどうかを示す.次の3つの状態がある: /// is_closed=0 - 曲線は閉曲線として扱われない. /// is_closed>0 - 曲線は閉曲線として扱われる. /// is_closed<0 - 曲線がシーケンスの場合, ((CvSeq*)curve)->flagsのフラグCV_SEQ_FLAG_CLOSEDから閉曲線かどうかを判別する.そうでない(曲線が点の配列(CvMat*)で表現される)場合,閉曲線として扱われない. /// </param> /// <returns>輪郭の周囲長または曲線の長さ</returns> #else /// <summary> /// Calculates contour perimeter or curve length /// </summary> /// <param name="curve">Sequence or array of the curve points. </param> /// <param name="slice">Starting and ending points of the curve, by default the whole curve length is calculated. </param> /// <param name="isClosed">Indicates whether the curve is closed or not. There are 3 cases: /// * is_closed=0 - the curve is assumed to be unclosed. /// * is_closed>0 - the curve is assumed to be closed. /// * is_closed<0 - if curve is sequence, the flag CV_SEQ_FLAG_CLOSED of ((CvSeq*)curve)->flags is checked to determine if the curve is closed or not, otherwise (curve is represented by array (CvMat*) of points) it is assumed to be unclosed. </param> /// <returns></returns> #endif public static double ArcLength(CvArr curve, CvSlice slice, int isClosed) { if (curve == null) { throw new ArgumentNullException("curve"); } return NativeMethods.cvArcLength(curve.CvPtr, slice, isClosed); }
/// <summary> /// 指定された弱い決定木を削除する /// </summary> /// <param name="slice"></param> #else /// <summary> /// Removes specified weak classifiers /// </summary> /// <param name="slice"></param> #endif public virtual void Prune(CvSlice slice) { MLInvoke.CvBoost_prune(ptr, slice); }
/// <summary> /// 入力サンプルに対する応答を予測する /// </summary> /// <param name="sample">入力サンプル</param> /// <param name="missing">データ欠損マスク(オプション).データ欠損を扱うためには,弱い決定木が代理分岐を含まなければならない.</param> /// <param name="weakResponses">個々の弱い決定木からの応答の出力パラメータ(オプション)で,これは浮動小数点型ベクトルである.ベクトルの要素数は,slice 長と等しくなければならない.</param> /// <param name="slice">予測に用いられる弱い決定木シーケンスの連続的部分集合(スライス).デフォルトでは,全ての弱い分類器が用いられる.</param> /// <param name="rawMode">falseは通常の入力を意味する.true の場合,このメソッドは離散入力変数の全ての値があらかじめ, 0..<num_of_categories_i>-1 の範囲に正規化されていることを仮定する(決定木は内部的にはこのような正規化された表現を用いている).これは決定木集合の高速な予測に役立つ.連続変数の入力変数に対しては,このフラグは利用されない.</param> /// <param name="returnSum"></param> /// <returns>重み付き投票に基づく出力クラスラベル</returns> #else /// <summary> /// Predicts response for the input sample /// </summary> /// <param name="sample">The input sample. </param> /// <param name="missing">The optional mask of missing measurements. To handle missing measurements, the weak classifiers must include surrogate splits. </param> /// <param name="weakResponses">The optional output parameter, a floating-point vector, of responses from each individual weak classifier. The number of elements in the vector must be equal to the slice length. </param> /// <param name="slice">The continuous subset of the sequence of weak classifiers to be used for prediction. By default, all the weak classifiers are used. </param> /// <param name="rawMode">The last parameter is normally set to false that implies a regular input. If it is true, the method assumes that all the values of the discrete input variables have been already normalized to 0..<num_of_categoriesi>-1 ranges. (as the decision tree uses such normalized representation internally). It is useful for faster prediction with tree ensembles. For ordered input variables the flag is not used. </param> /// <param name="returnSum"></param> /// <returns>the output class label based on the weighted voting. </returns> #endif public float Predict( CvMat sample, CvMat missing = null, CvMat weakResponses = null, CvSlice? slice = null, bool rawMode = false, bool returnSum = false) { if (sample == null) throw new ArgumentNullException("sample"); CvSlice slice0 = slice.GetValueOrDefault(CvSlice.WholeSeq); return NativeMethods.ml_CvBoost_predict_CvMat( ptr, sample.CvPtr, Cv2.ToPtr(missing), Cv2.ToPtr(weakResponses), slice0, rawMode ? 1 : 0, returnSum ? 1 : 0); }