Beispiel #1
0
  public void process(double c_x, double c_y, double scale, double orientation, SurfFeature desc) {
    // determine where this feature lies inside the scale-space
    int imageIndex = ss.scaleToImageIndex(scale);
    double pixelScale = ss.imageIndexToPixelScale(imageIndex);

    process(c_x, c_y, scale, orientation, imageIndex, pixelScale, desc);
  }
Beispiel #2
0
  /**
   * Compute the descriptor with information on which level in the scale-space to use.
   *
   * @param c_x Location of feature in input image
   * @param c_y Location of feature in input image
   * @param scale Size of the feature in the input image
   * @param orientation Orientation of the feature
   * @param imageIndex Which octave contains the feature
   * @param pixelScale The scale of a pixel in the octave
   * @param desc (Output) storage for the descriptor
   */
  public void process(
      double c_x,
      double c_y,
      double scale,
      double orientation,
      int imageIndex,
      double pixelScale,
      SurfFeature desc) {
    image = ss.getPyramidLayer(imageIndex);
    derivX = ss.getDerivativeX(imageIndex);
    derivY = ss.getDerivativeY(imageIndex);

    for (int i = 0; i < desc.value.length; i++) desc.value[i] = 0;
    for (int i = 0; i < histograms.length; i++)
      for (int j = 0; j < histograms[i].length; j++) histograms[i][j] = 0;

    // account for the scale of the image in each octave
    constructHistograms(c_x / pixelScale, c_y / pixelScale, scale / pixelScale, orientation);

    computeDescriptor(desc);
  }
  /**
   * Processes the image and extracts SIFT features
   *
   * @param input input image
   */
  public void process(ImageFloat32 input) {

    features.reset();
    featureScales.reset();
    featureAngles.reset();
    location.reset();

    ss.constructPyramid(input);
    ss.computeFeatureIntensity();
    ss.computeDerivatives();

    detector.process(ss);
    orientation.setScaleSpace(ss);
    describe.setScaleSpace(ss);

    FastQueue<ScalePoint> found = detector.getFoundPoints();

    for (int i = 0; i < found.size; i++) {
      ScalePoint sp = found.data[i];
      orientation.process(sp.x, sp.y, sp.scale);

      GrowQueue_F64 angles = orientation.getOrientations();

      int imageIndex = orientation.getImageIndex();
      double pixelScale = orientation.getPixelScale();

      for (int j = 0; j < angles.size; j++) {
        SurfFeature desc = features.grow();

        double yaw = angles.data[j];

        describe.process(sp.x, sp.y, sp.scale, yaw, imageIndex, pixelScale, desc);

        desc.laplacianPositive = sp.white;
        featureScales.push(sp.scale);
        featureAngles.push(yaw);
        location.grow().set(sp.x, sp.y);
      }
    }
  }