org.openimaj.image.feature.local.keypoints.Keypoint类的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(85)

本文整理了Java中org.openimaj.image.feature.local.keypoints.Keypoint类的一些代码示例,展示了Keypoint类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Keypoint类的具体详情如下:
包路径:org.openimaj.image.feature.local.keypoints.Keypoint
类名称:Keypoint

Keypoint介绍

[英]A local interest point with a location, scale, orientation and associated feature. The feature is stored as an array of bytes.
[中]具有位置、比例、方向和关联特征的局部兴趣点。该功能以字节数组的形式存储。

代码示例

代码示例来源:origin: openimaj/openimaj

protected Keypoint makeKeypoint(QuantisedKeypoint kpt) {
  Keypoint key = new Keypoint();
  
  key.y = kpt.location.y;
  key.x = kpt.location.x;
  key.scale = kpt.location.scale;
  key.ori = kpt.location.orientation;
  
  return key; 
}

代码示例来源:origin: org.openimaj/image-local-features

@Override
public String asciiHeader() {
  return super.asciiHeader();
}

代码示例来源:origin: openimaj/openimaj

@Override
public byte[] binaryHeader() {
  return super.binaryHeader();
}

代码示例来源:origin: org.openimaj/image-local-features

@Override
public Keypoint transform(Matrix transform) {
  float xt = (float) transform.get(0, 0) * getX() + (float) transform.get(0, 1) * getY()
      + (float) transform.get(0, 2);
  float yt = (float) transform.get(1, 0) * getX() + (float) transform.get(1, 1) * getY()
      + (float) transform.get(1, 2);
  final float zt = (float) transform.get(2, 0) * getX() + (float) transform.get(2, 1) * getY()
      + (float) transform.get(2, 2);
  xt /= zt;
  yt /= zt;
  return new Keypoint(xt, yt, this.ori, this.scale, this.ivec.clone());
}

代码示例来源:origin: openimaj/openimaj

protected void loadMapData() {
  for (int i = 0; i < mapKeypointFiles.length; i++) {
    try {
      // read keypoints for current tile
      final MemoryLocalFeatureList<Keypoint> map = MemoryLocalFeatureList.read(mapKeypointFiles[i],
          Keypoint.class);
      // loop through each keypoint in the tile and
      // adjust its position, so that the keypoints
      // x and y position is its true OSGB grid ref!
      for (final Keypoint k : map) {
        final int east = baseEasting[i] + Math.round(10.0f * (k.getX() / scaleFactor));
        final int north = baseNorthing[i]
            + Math.round(10.0f * ((mapDimension - k.getY()) / scaleFactor)); // different
        // coord systems!!
        k.setX(east);
        k.setY(north);
      }
      mapData.addAll(map);
    } catch (final Exception ex) {
      System.out.println(ex);
      System.exit(1);
    }
  }
}

代码示例来源:origin: org.openimaj/image-local-features

@Override
public void copyFrom(Point2d p) {
  setX(p.getX());
  setY(p.getY());
}

代码示例来源:origin: openimaj/openimaj

@Override
public Keypoint transform(Matrix transform) {
  float xt = (float) transform.get(0, 0) * getX() + (float) transform.get(0, 1) * getY()
      + (float) transform.get(0, 2);
  float yt = (float) transform.get(1, 0) * getX() + (float) transform.get(1, 1) * getY()
      + (float) transform.get(1, 2);
  final float zt = (float) transform.get(2, 0) * getX() + (float) transform.get(2, 1) * getY()
      + (float) transform.get(2, 2);
  xt /= zt;
  yt /= zt;
  return new Keypoint(xt, yt, this.ori, this.scale, this.ivec.clone());
}

代码示例来源:origin: org.openimaj/sandbox

protected void loadMapData() {
  for (int i = 0; i < mapKeypointFiles.length; i++) {
    try {
      // read keypoints for current tile
      final MemoryLocalFeatureList<Keypoint> map = MemoryLocalFeatureList.read(mapKeypointFiles[i],
          Keypoint.class);
      // loop through each keypoint in the tile and
      // adjust its position, so that the keypoints
      // x and y position is its true OSGB grid ref!
      for (final Keypoint k : map) {
        final int east = baseEasting[i] + Math.round(10.0f * (k.getX() / scaleFactor));
        final int north = baseNorthing[i]
            + Math.round(10.0f * ((mapDimension - k.getY()) / scaleFactor)); // different
        // coord systems!!
        k.setX(east);
        k.setY(north);
      }
      mapData.addAll(map);
    } catch (final Exception ex) {
      System.out.println(ex);
      System.exit(1);
    }
  }
}

代码示例来源:origin: openimaj/openimaj

@Override
public void copyFrom(Point2d p) {
  setX(p.getX());
  setY(p.getY());
}

代码示例来源:origin: org.openimaj/image-local-features

/**
 * Default constructor
 * 
 * @param threshold
 *            threshold for determining matching keypoints
 */
public LocalConsistentKeypointMatcher(int threshold) {
  super(threshold);
  model = null;
  consistentMatches = new ArrayList<Pair<T>>();
  minDim = new Keypoint();
  maxDim = new Keypoint();
}

代码示例来源:origin: openimaj/openimaj

@Override
public String asciiHeader() {
  return super.asciiHeader();
}

代码示例来源:origin: org.openimaj/image-local-features

@Override
public byte[] binaryHeader() {
  return super.binaryHeader();
}

代码示例来源:origin: openimaj/openimaj

/**
 * Default constructor
 * 
 * @param threshold
 *            threshold for determining matching keypoints
 */
public LocalConsistentKeypointMatcher(int threshold) {
  super(threshold);
  model = null;
  consistentMatches = new ArrayList<Pair<T>>();
  minDim = new Keypoint();
  maxDim = new Keypoint();
}

代码示例来源:origin: openimaj/openimaj

@Override
public Keypoint clone() {
  final Keypoint clone = new Keypoint();
  clone.x = x;
  clone.ori = ori;
  clone.y = y;
  clone.scale = scale;
  clone.ivec = new byte[ivec.length];
  System.arraycopy(ivec, 0, clone.ivec, 0, ivec.length);
  return clone;
}

代码示例来源:origin: org.openimaj/image-local-features

@Override
public Keypoint clone() {
  final Keypoint clone = new Keypoint();
  clone.x = x;
  clone.ori = ori;
  clone.y = y;
  clone.scale = scale;
  clone.ivec = new byte[ivec.length];
  System.arraycopy(ivec, 0, clone.ivec, 0, ivec.length);
  return clone;
}

代码示例来源:origin: openimaj/openimaj

/**
 * Scale a list of keypoints by the given amount. This scales the location
 * and scale of each keypoint. The original features are untouched; the
 * returned list contains a copy.
 *
 * @param keypoints
 *            the input features.
 * @param toScale
 *            the scale factor
 * @return the scaled features.
 */
public static List<Keypoint> getScaledKeypoints(List<Keypoint> keypoints, int toScale) {
  final List<Keypoint> shifted = new ArrayList<Keypoint>();
  for (final Keypoint old : keypoints) {
    final Keypoint n = new Keypoint();
    n.x = old.x * toScale;
    n.y = old.y * toScale;
    n.ivec = old.ivec;
    n.scale = old.scale * toScale;
    n.ori = old.ori;
    shifted.add(n);
  }
  return shifted;
}

代码示例来源:origin: org.openimaj/image-local-features

/**
 * Scale a list of keypoints by the given amount. This scales the location
 * and scale of each keypoint. The original features are untouched; the
 * returned list contains a copy.
 *
 * @param keypoints
 *            the input features.
 * @param toScale
 *            the scale factor
 * @return the scaled features.
 */
public static List<Keypoint> getScaledKeypoints(List<Keypoint> keypoints, int toScale) {
  final List<Keypoint> shifted = new ArrayList<Keypoint>();
  for (final Keypoint old : keypoints) {
    final Keypoint n = new Keypoint();
    n.x = old.x * toScale;
    n.y = old.y * toScale;
    n.ivec = old.ivec;
    n.scale = old.scale * toScale;
    n.ori = old.ori;
    shifted.add(n);
  }
  return shifted;
}

代码示例来源:origin: openimaj/openimaj

/**
 * Create a list of {@link Keypoint}s from the input list, but with the
 * positions offset by the given amount.
 *
 * @param keypoints
 *            the input list
 * @param x
 *            the x offset
 * @param y
 *            the y offset
 * @return the new keypoints
 */
public static List<Keypoint> getRelativeKeypoints(List<Keypoint> keypoints, float x, float y) {
  final List<Keypoint> shifted = new ArrayList<Keypoint>();
  for (final Keypoint old : keypoints) {
    final Keypoint n = new Keypoint();
    n.x = old.x - x;
    n.y = old.y - y;
    n.ivec = old.ivec;
    n.scale = old.scale;
    n.ori = old.ori;
    shifted.add(n);
  }
  return shifted;
}

代码示例来源:origin: org.openimaj/image-local-features

/**
 * Create a list of {@link Keypoint}s from the input list, but with the
 * positions offset by the given amount.
 *
 * @param keypoints
 *            the input list
 * @param x
 *            the x offset
 * @param y
 *            the y offset
 * @return the new keypoints
 */
public static List<Keypoint> getRelativeKeypoints(List<Keypoint> keypoints, float x, float y) {
  final List<Keypoint> shifted = new ArrayList<Keypoint>();
  for (final Keypoint old : keypoints) {
    final Keypoint n = new Keypoint();
    n.x = old.x - x;
    n.y = old.y - y;
    n.ivec = old.ivec;
    n.scale = old.scale;
    n.ori = old.ori;
    shifted.add(n);
  }
  return shifted;
}

代码示例来源:origin: org.openimaj/image-local-features

protected void addFeature(float imx, float imy, float imscale) {
    OrientedFeatureVector[] fvs = featureExtractor.extractFeature(extractionProperties);
    
    for (OrientedFeatureVector fv : fvs) {
      features.add(new Keypoint(imx, imy, fv.orientation, imscale, fv.values));
    }
  }
}

相关文章