/// <summary> /// Classifies <paramref name="image"/>, creating a distribution over all labels at each pixel. /// </summary> /// <param name="tree">The tree used for the computation</param> /// <param name="image">Image to classify</param> /// <returns>Distributions at each pixel</returns> public static DistributionImage ClassifySoft <T>(this DecisionTree <ImageDataPoint <T>, T[]> tree, IMultichannelImage <T> image) { DistributionImage dist = new DistributionImage(image.Rows, image.Columns, tree.LabelCount); tree.ClassifySoft(image, dist); dist.Normalize(); return(dist); }
/// <summary> /// Classifies each pixel of <paramref name="image"/> and produces a corresponding <see cref="T:LabelImage" />. The maximum likelihood label /// is chosen at each pixel. /// </summary> /// <param name="tree">The tree used for the computation</param> /// <param name="image">Image to classify</param> /// <returns>A label image with all of the classifications</returns> public static LabelImage Classify <T>(this DecisionTree <ImageDataPoint <T>, T[]> tree, IMultichannelImage <T> image) { return(tree.ClassifySoft(image).ToLabelImage()); }