private void addFeatureOrientations(GaussianScaleSpacePyramid i_pyramid, DogFeaturePoint dfp, DogFeaturePointStack i_ot_fps)
        {
            double[] tmp = this._addFeatureOrientations_tmp;


            double x, y, s;

            // Down sample the point to the detected octave
            bilinear_downsample_point(tmp, dfp.x, dfp.y, dfp.sigma, dfp.octave);
            x = tmp[0];
            y = tmp[1];
            s = tmp[2];

            // Downsampling the point can cause (x,y) to leave the image bounds
            // by
            // a tiny amount. Here we just clip it to be within the image
            // bounds.
            x = ClipScalar(x, 0, i_pyramid.get(dfp.octave, 0).getWidth() - 1);
            y = ClipScalar(y, 0, i_pyramid.get(dfp.octave, 0).getHeight() - 1);

            // Compute dominant orientations
            int num_angles = mOrientationAssignment.compute(dfp.octave, dfp.scale, x, y, s, this.mOrientations);

            // Create a feature point for each angle
            for (int j = 0; j < num_angles; j++)
            {
                // Copy the feature point
                DogFeaturePoint fp = i_ot_fps.prePush();
                if (fp == null)
                {
                    //中断
                    //				prepush_warning();
                    break;
                }
                fp.x          = dfp.x;
                fp.y          = dfp.y;
                fp.octave     = dfp.octave;
                fp.scale      = dfp.scale;
                fp.sp_scale   = dfp.sp_scale;
                fp.score      = dfp.score;
                fp.sigma      = dfp.sigma;
                fp.edge_score = dfp.edge_score;
                fp.angle      = mOrientations[j];
            }
            return;
        }
Esempio n. 2
0
        /**
         * Sample a receptor given (x,y,octave,scale) and a pyramid.
         */
        private double SampleReceptor(GaussianScaleSpacePyramid pyramid, double x, double y, int octave, int scale)
        {
            // Get the correct image from the pyramid
            KpmImage image = pyramid.get(octave, scale);
            double   a     = 1.0f / (1 << octave);
            double   b     = 0.5f * a - 0.5f;

            return(image.bilinearInterpolation(ClipScalar(x * a + b, 0, image.getWidth() - 2), ClipScalar(y * a + b, 0, image.getHeight() - 2)));
        }
Esempio n. 3
0
 /**
  * Compute the Difference-of-Gaussian from a Gaussian Pyramid.
  */
 public void compute(GaussianScaleSpacePyramid pyramid)
 {
     for (int i = 0; i < this.mNumOctaves; i++)
     {
         for (int j = 0; j < this.mNumScalesPerOctave; j++)
         {
             this.mImages[i * mNumScalesPerOctave + j].difference_image_binomial(pyramid.get(i, j), pyramid.get(i, j + 1));
         }
     }
 }