Exemplo n.º 1
0
 /// <summary>
 /// The method takes the feature vector and the optional missing measurement mask on input, traverses the random tree and returns the cumulative result from all the trees in the forest (the class that receives the majority of voices, or the mean of the regression function estimates)
 /// </summary>
 /// <param name="sample">The sample to be predicted</param>
 /// <param name="missingDataMask">Can be null if not needed. When specified, it is an 8-bit matrix of the same size as <i>trainData</i>, is used to mark the missed values (non-zero elements of the mask)</param>
 /// <param name="weakResponses">Can be null if not needed. 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</param>
 /// <param name="rawMode">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 cumulative result from all the trees in the forest (the class that receives the majority of voices, or the mean of the regression function estimates)</returns>
 public float Predict(
     Matrix <float> sample,
     Matrix <Byte> missingDataMask,
     Matrix <float> weakResponses,
     MCvSlice slice,
     bool rawMode
     )
 {
     return(MlInvoke.CvBoostPredict(
                _ptr,
                sample.Ptr,
                missingDataMask == null ? IntPtr.Zero : missingDataMask.Ptr,
                weakResponses == null? IntPtr.Zero : weakResponses.Ptr,
                slice,
                rawMode));
 }
Exemplo n.º 2
0
 /// <summary>
 /// Creates a sequence that represents the specified slice of the input sequence. The new sequence either shares the elements with the original sequence or has own copy of the elements. So if one needs to process a part of sequence but the processing function does not have a slice parameter, the required sub-sequence may be extracted using this function
 /// </summary>
 /// <param name="slice">The part of the sequence to extract</param>
 /// <param name="storage">The destination storage to keep the new sequence header and the copied data if any. If it is NULL, the function uses the storage containing the input sequence.</param>
 /// <param name="copy_data">The flag that indicates whether to copy the elements of the extracted slice </param>
 /// <returns>A sequence that represents the specified slice of the input sequence</returns>
 public Seq <T> Slice(MCvSlice slice, MemStorage storage, bool copy_data)
 {
     return(new Seq <T>(CvInvoke.cvSeqSlice(Ptr, slice, storage.Ptr, copy_data), storage));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Create a CudaImage from the specific region of <paramref name="image"/>. The data is shared between the two CudaImage
 /// </summary>
 /// <param name="image">The CudaImage where the region is extracted from</param>
 /// <param name="colRange">The column range. Use MCvSlice.WholeSeq for all columns.</param>
 /// <param name="rowRange">The row range. Use MCvSlice.WholeSeq for all rows.</param>
 public CudaImage(CudaImage <TColor, TDepth> image, MCvSlice rowRange, MCvSlice colRange)
     : this(CudaInvoke.GetRegion(image, ref rowRange, ref colRange), true)
 {
 }
Exemplo n.º 4
0
 /// <summary>
 /// Create a GpuMat from the specific region of <paramref name="mat"/>. The data is shared between the two GpuMat
 /// </summary>
 /// <param name="mat">The matrix where the region is extracted from</param>
 /// <param name="colRange">The column range. Use MCvSlice.WholeSeq for all columns.</param>
 /// <param name="rowRange">The row range. Use MCvSlice.WholeSeq for all rows.</param>
 public GpuMat(GpuMat mat, MCvSlice rowRange, MCvSlice colRange)
     : this(CudaInvoke.GetRegion(mat, ref rowRange, ref colRange), true)
 {
 }
Exemplo n.º 5
0
 /// <summary>
 /// Create a GpuImage from the specific region of <paramref name="image"/>. The data is shared between the two GpuImage
 /// </summary>
 /// <param name="image">The GpuImage where the region is extracted from</param>
 /// <param name="colRange">The column range. Use MCvSlice.WholeSeq for all columns.</param>
 /// <param name="rowRange">The row range. Use MCvSlice.WholeSeq for all rows.</param>
 public GpuImage(GpuImage <TColor, TDepth> image, MCvSlice rowRange, MCvSlice colRange)
     : this(GpuInvoke.GpuMatGetRegion(image, rowRange, colRange))
 {
 }
Exemplo n.º 6
0
 /// <summary>
 /// Create a GpuMat from the specific region of <paramref name="mat"/>. The data is shared between the two GpuMat
 /// </summary>
 /// <param name="mat">The matrix where the region is extracted from</param>
 /// <param name="colRange">The column range. Use MCvSlice.WholeSeq for all columns.</param>
 /// <param name="rowRange">The row range. Use MCvSlice.WholeSeq for all rows.</param>
 public GpuMat(GpuMat <TDepth> mat, MCvSlice rowRange, MCvSlice colRange)
 {
     _ptr = GpuInvoke.GpuMatGetRegion(mat, rowRange, colRange);
 }