Exemple #1
0
        /// <summary>
        /// Computes a histogram for all trees from the provided image.
        /// </summary>
        /// <param name="forest">The forest used for the computation</param>
        /// <param name="image">Image to classify</param>
        /// <returns>The histogram</returns>
        public static TreeHistogram ComputeHistogram <T>(this DecisionForest <ImageDataPoint <T>, T[]> forest, IMultichannelImage <T> image)
        {
            int rows    = image.Rows;
            int columns = image.Columns;
            List <ImageDataPoint <T> > points = new List <ImageDataPoint <T> >();

            for (short r = 0; r < rows; r++)
            {
                for (short c = 0; c < columns; c++)
                {
                    points.Add(new ImageDataPoint <T>(image, r, c, -1));
                }
            }
            return(forest.ComputeHistogram(points));
        }
Exemple #2
0
 /// <summary>
 /// Computes a histogram for all trees from the provided image.
 /// </summary>
 /// <param name="forest">The forest used for the computation</param>
 /// <param name="image">Image to classify</param>
 /// <returns>The histogram</returns>
 public static TreeHistogram ComputeHistogram <T>(this DecisionForest <ImageDataPoint <T>, T[]> forest, LabeledImage <T> image)
 {
     return(forest.ComputeHistogram(image.CreateAllDataPoints(BackgroundSampleMode.Full)));
 }