Exemplo n.º 1
0
  public List<FastRetinaKeypoint> ProcessImage(FastBitmap fastBitmap) {

    if (fastBitmap.isGrayscale()) {
      grayImage = new FastBitmap(fastBitmap);
    } else {
      grayImage = new FastBitmap(fastBitmap);
      grayImage.toGrayscale();
    }

    // 1. Extract corners points from the image.
    List<FastRetinaKeypoint> features = new ArrayList<FastRetinaKeypoint>();
    if (Detector != null) {
      List<IntPoint> corners = Detector.ProcessImage(grayImage);

      for (int i = 0; i < corners.size(); i++)
        features.add(new FastRetinaKeypoint(corners.get(i).x, corners.get(i).y));
    } else {
      List<FeaturePoint> corners = FDetector.ProcessImage(grayImage);

      for (int i = 0; i < corners.size(); i++)
        features.add(new FastRetinaKeypoint(corners.get(i).x, corners.get(i).y));
    }

    // 2. Compute the integral for the given image
    integral = IntegralImage.FromFastBitmap(grayImage);

    // 3. Compute feature descriptors if required
    descriptor = null;
    if (featureType != FastRetinaKeypointDescriptorType.None) {
      descriptor = GetDescriptor();
      descriptor.Compute(features);
    }
    return features;
  }
Exemplo n.º 2
0
  public FastRetinaKeypointDescriptor GetDescriptor() {
    if (descriptor == null || pattern == null) {
      if (pattern == null) pattern = new FastRetinaKeypointPattern(octaves, scale);

      descriptor = new FastRetinaKeypointDescriptor(grayImage, integral, pattern);
      descriptor.setExtended(featureType == FastRetinaKeypointDescriptorType.Extended);
    }

    return descriptor;
  }