/// <summary>
        /// Creates template from the input image by using provided parameters.
        /// </summary>
        /// <param name="sourceImage">Input image.</param>
        /// <param name="minFeatureStrength">Minimum gradient value for the feature.</param>
        /// <param name="maxNumberOfFeatures">Maximum number of features per template. The features will be extracted so that their locations are semi-uniformly spread.</param>
        /// <param name="classLabel">Template class label.</param>
        public virtual void Initialize(Bgr <byte>[,] sourceImage, int minFeatureStrength, int maxNumberOfFeatures, string classLabel)
        {
            Gray <int>[,] sqrMagImg;
            Gray <int>[,] orientationImg = GradientComputation.Compute(sourceImage, out sqrMagImg, minFeatureStrength);

            Func <Feature, int> featureImportanceFunc = (feature) => sqrMagImg[feature.Y, feature.X].Intensity;

            Initialize(orientationImg, maxNumberOfFeatures, classLabel, featureImportanceFunc);
        }
        /// <summary>
        /// Creates template from the input image by using provided parameters.
        /// </summary>
        /// <param name="sourceImage">Input image.</param>
        /// <param name="minFeatureStrength">Minimum gradient value for the feature.</param>
        /// <param name="maxNumberOfFeatures">Maximum number of features per template. The features will be extracted so that their locations are semi-uniformly spread.</param>
        /// <param name="classLabel">Template class label.</param>
        public virtual void Initialize(Image <Bgr, byte> sourceImage, int minFeatureStrength, int maxNumberOfFeatures, string classLabel)
        {
            Image <Gray, int> sqrMagImg;
            Image <Gray, int> orientationImg = GradientComputation.Compute(sourceImage, out sqrMagImg, minFeatureStrength);

            Func <Feature, int> featureImportanceFunc = (feature) => *(byte *)sqrMagImg.GetData(feature.Y, feature.X);

            Initialize(orientationImg, maxNumberOfFeatures, classLabel, featureImportanceFunc);
        }
 /// <summary>
 /// Creates linearized maps pyramid.
 /// </summary>
 /// <param name="sourceImage">Source image.</param>
 /// <param name="minGradientMagnitude">Minimal gradient value threshold.</param>
 /// <param name="neigborhoodPerLevel">Neighborhood per level. If null default neighborhood is going to be used.</param>
 /// <returns>Pyramid of linearized maps.</returns>
 public static LinearizedMapPyramid CreatePyramid(Bgr <byte>[,] sourceImage, int minGradientMagnitude = 35, params int[] neigborhoodPerLevel)
 {
     return(CreatePyramid(sourceImage,
                          source =>
     {
         Gray <int>[,] sqrMagImg;
         return GradientComputation.Compute(sourceImage, out sqrMagImg, minGradientMagnitude);
     },
                          neigborhoodPerLevel));
 }
Пример #4
0
        /// <summary>
        /// Creates template from the input image by using provided parameters.
        /// </summary>
        /// <param name="sourceImage">Input image.</param>
        /// <param name="minFeatureStrength">Minimum gradient value for the feature.</param>
        /// <param name="maxNumberOfFeatures">Maximum number of features per template. The features will be extracted so that their locations are semi-uniformly spread.</param>
        /// <param name="classLabel">Template class label.</param>
        /// <param name="angle"></param>
        public virtual void Initialize(Bgr <byte>[,] sourceImage, int minFeatureStrength, int maxNumberOfFeatures, string classLabel, float angle)
        {
            Gray <int>[,] sqrMagImg;
            // so at this point oriImage is a image full of degrees? not gradient?
            Gray <int>[,] orientationImg = GradientComputation.Compute(sourceImage, out sqrMagImg, minFeatureStrength);

            Func <Feature, int> featureImportanceFunc = (feature) => sqrMagImg[feature.Y, feature.X].Intensity;

            Initialize(orientationImg, maxNumberOfFeatures, classLabel, angle, featureImportanceFunc);
        }