/// <summary>
 /// Sets a matrix header for the specified matrix row/column span.
 /// </summary>
 /// <param name="rowRange"></param>
 /// <param name="colRange"></param>
 /// <param name="value"></param>
 /// <returns></returns>
 public void Set(Range rowRange, Range colRange, MatExpr value)
 {
     this[rowRange, colRange] = value;
 }
 /// <summary>
 /// Creates a matrix header for the specified row/column span.
 /// </summary>
 /// <param name="rowRange"></param>
 /// <param name="colRange"></param>
 /// <returns></returns>
 public abstract MatExpr this[Range rowRange, Range colRange] { get; set; }
Exemple #3
0
        /// <summary>
        /// 入力サンプルに対する応答を予測する
        /// </summary>
        /// <param name="sample">入力サンプル</param>
		/// <param name="missing">データ欠損マスク(オプション).データ欠損を扱うためには,弱い決定木が代理分岐を含まなければならない.</param>
		/// <param name="slice">予測に用いられる弱い決定木シーケンスの連続的部分集合(スライス).デフォルトでは,全ての弱い分類器が用いられる.</param>
        /// <param name="rawMode">falseは通常の入力を意味する.true の場合,このメソッドは離散入力変数の全ての値があらかじめ, 0..&lt;num_of_categories_i&gt;-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..&lt;num_of_categoriesi&gt;-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);
        }
Exemple #4
0
        /// <summary>
        /// 指定された弱い決定木を削除する
        /// </summary>
        /// <param name="slice"></param>
#else
        /// <summary>
        /// Removes specified weak classifiers
        /// </summary>
        /// <param name="slice"></param>
#endif
		public virtual void Prune(Range slice)
		{    
			NativeMethods.ml_CvBoost_prune(ptr, slice);
		}
 /// <summary>
 /// Creates/Sets a matrix header for the specified row/column span.
 /// </summary>
 /// <param name="range"></param>
 /// <returns></returns>
 public virtual Mat this[Range range]
 {
     get { return this[range.Start, range.End]; }
 }
 /// <summary>
 /// Creates/Sets a matrix header for the specified row/column span.
 /// </summary>
 /// <param name="range"></param>
 /// <returns></returns>
 public virtual Mat this[Range range]
 {
     get { return(this[range.Start, range.End]); }
 }
 public static extern IntPtr core_Mat_new5(IntPtr mat, Range rowRange);
Exemple #8
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="rowRange"></param>
 /// <param name="colRange"></param>
 /// <returns></returns>
 public MatExpr SubMat(Range rowRange, Range colRange)
 {
     return SubMat(rowRange.Start, rowRange.End, colRange.Start, colRange.End);
 }
Exemple #9
0
        /// <summary>
        /// 他の行列の部分行列として初期化
        /// </summary>
        /// <param name="m">作成された行列に(全体的,部分的に)割り当てられる配列.
        /// これらのコンストラクタによってデータがコピーされる事はありません.
        /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され,
        /// 関連した参照カウンタがあれば,それがインクリメントされます.
        /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も
        /// 変更することになります.もし部分配列の独立したコピーが必要ならば,
        /// Mat.Clone() を利用してください.</param>
        /// <param name="rowRange">扱われる 行列の行の範囲.すべての行を扱う場合は,Range.All を利用してください.</param>
        /// <param name="colRange">扱われる 行列の列の範囲.すべての列を扱う場合は,Range.All を利用してください.</param>
#else
        /// <summary>
        /// creates a matrix header for a part of the bigger matrix
        /// </summary>
        /// <param name="m">Array that (as a whole or partly) is assigned to the constructed matrix.
        /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array
        /// is constructed and associated with it. The reference counter, if any, is incremented.
        /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m .
        /// If you want to have an independent copy of the sub-array, use Mat::clone() .</param>
        /// <param name="rowRange">Range of the m rows to take. As usual, the range start is inclusive and the range end is exclusive.
        /// Use Range.All to take all the rows.</param>
        /// <param name="colRange">Range of the m columns to take. Use Range.All to take all the columns.</param>
#endif
        public MatOfDMatch(MatOfDMatch m, Range rowRange, Range?colRange = null)
            : base(m, rowRange, colRange)
        {
        }
 public static extern IntPtr core_Mat_new4(IntPtr mat, Range rowRange, Range colRange);
Exemple #11
0
        /// <summary>
        /// 他の行列の部分行列として初期化
        /// </summary>
        /// <param name="m">作成された行列に(全体的,部分的に)割り当てられる配列.
        /// これらのコンストラクタによってデータがコピーされる事はありません.
        /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され,
        /// 関連した参照カウンタがあれば,それがインクリメントされます.
        /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も
        /// 変更することになります.もし部分配列の独立したコピーが必要ならば,
        /// Mat.Clone() を利用してください.</param>
        /// <param name="rowRange">扱われる 行列の行の範囲.すべての行を扱う場合は,Range.All を利用してください.</param>
        /// <param name="colRange">扱われる 行列の列の範囲.すべての列を扱う場合は,Range.All を利用してください.</param>
#else
        /// <summary>
        /// creates a matrix header for a part of the bigger matrix
        /// </summary>
        /// <param name="m">Array that (as a whole or partly) is assigned to the constructed matrix.
        /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array
        /// is constructed and associated with it. The reference counter, if any, is incremented.
        /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m .
        /// If you want to have an independent copy of the sub-array, use Mat::clone() .</param>
        /// <param name="rowRange">Range of the m rows to take. As usual, the range start is inclusive and the range end is exclusive.
        /// Use Range.All to take all the rows.</param>
        /// <param name="colRange">Range of the m columns to take. Use Range.All to take all the columns.</param>
#endif
        public MatOfUShort(MatOfUShort m, Range rowRange, Range?colRange = null)
            : base(m, rowRange, colRange)
        {
        }
Exemple #12
0
        /// <summary>
        /// 他の行列の部分行列として初期化
        /// </summary>
        /// <param name="m">作成された行列に(全体的,部分的に)割り当てられる配列.
        /// これらのコンストラクタによってデータがコピーされる事はありません.
        /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され,
        /// 関連した参照カウンタがあれば,それがインクリメントされます.
        /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も
        /// 変更することになります.もし部分配列の独立したコピーが必要ならば,
        /// Mat.Clone() を利用してください.</param>
        /// <param name="rowRange">扱われる 行列の行の範囲.すべての行を扱う場合は,Range.All を利用してください.</param>
        /// <param name="colRange">扱われる 行列の列の範囲.すべての列を扱う場合は,Range.All を利用してください.</param>
#else
        /// <summary>
        /// creates a matrix header for a part of the bigger matrix
        /// </summary>
        /// <param name="m">Array that (as a whole or partly) is assigned to the constructed matrix.
        /// No data is copied by these constructors. Instead, the header pointing to m data or its sub-array
        /// is constructed and associated with it. The reference counter, if any, is incremented.
        /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m .
        /// If you want to have an independent copy of the sub-array, use Mat::clone() .</param>
        /// <param name="rowRange">Range of the m rows to take. As usual, the range start is inclusive and the range end is exclusive.
        /// Use Range.All to take all the rows.</param>
        /// <param name="colRange">Range of the m columns to take. Use Range.All to take all the columns.</param>
#endif
        public MatOfInt4(MatOfInt4 m, Range rowRange, Range?colRange = null)
            : base(m, rowRange, colRange)
        {
        }
 /// <summary>
 /// Creates a matrix header for the specified row/column span.
 /// </summary>
 /// <param name="range"></param>
 /// <returns></returns>
 public virtual Mat Get(Range range)
 {
     return(this[range]);
 }
 /// <summary>
 /// Creates a matrix header for the specified row/column span.
 /// </summary>
 /// <param name="rowRange"></param>
 /// <param name="colRange"></param>
 /// <returns></returns>
 public MatExpr Get(Range rowRange, Range colRange)
 {
     return this[rowRange, colRange];
 }
 /// <summary>
 /// Sets a matrix header for the specified matrix row/column span.
 /// </summary>
 /// <param name="range"></param>
 /// <param name="value"></param>
 /// <returns></returns>
 public void Set(Range range, MatExpr value)
 {
     this[range] = value;
 }
Exemple #16
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="rowRange"></param>
 /// <param name="colRange"></param>
 /// <returns></returns>
 public MatExpr this[Range rowRange, Range colRange]
 {
     get
     {
         return SubMat(rowRange, colRange);
     }
     set
     {
         if (value == null)
             throw new ArgumentNullException("value");
         MatExpr subMatExpr = SubMat(rowRange, colRange);
         NativeMethods.core_Mat_assignment_FromMatExpr(subMatExpr.CvPtr, value.CvPtr);
     }
 }
 /// <summary>
 /// Creates a matrix header for the specified row/column span.
 /// </summary>
 /// <param name="range"></param>
 /// <returns></returns>
 public virtual MatExpr this[Range range]
 {
     get { return this[range.Start, range.End]; }
     set { this[range.Start, range.End] = value; }
 }
 /// <summary>
 /// Creates/Sets a matrix header for the specified row/column span.
 /// </summary>
 /// <param name="range"></param>
 /// <param name="value"></param>
 public virtual void Set(Range range, Mat value)
 {
     this[range.Start, range.End] = value; 
 }
 /// <summary>
 /// Creates a matrix header for the specified row/column span.
 /// </summary>
 /// <param name="range"></param>
 /// <returns></returns>
 public MatExpr Get(Range range)
 {
     return this[range];
 }
 /// <summary>
 /// Creates a matrix header for the specified row/column span.
 /// </summary>
 /// <param name="range"></param>
 /// <returns></returns>
 public virtual Mat Get(Range range)
 {
     return this[range];
 }
 /// <summary>
 /// Creates/Sets a matrix header for the specified row/column span.
 /// </summary>
 /// <param name="range"></param>
 /// <param name="value"></param>
 public virtual void Set(Range range, Mat value)
 {
     this[range.Start, range.End] = value;
 }