org.openimaj.image.feature.local.keypoints.Keypoint.<init>()方法的使用及代码示例

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

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

Keypoint.<init>介绍

[英]Construct with the default feature vector length for SIFT (128).
[中]使用SIFT(128)的默认特征向量长度构造。

代码示例

代码示例来源: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: 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: 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: 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: 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: openimaj/openimaj

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));
    }
  }
}

代码示例来源: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));
    }
  }
}

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

toSkip -= dis.skip(toSkip);
final Keypoint kp = new Keypoint();
kp.x = dis.readFloat();
kp.y = dis.readFloat();

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

@Override
  public void perform(File file) {
    try {
      System.out.println(file);
      final LocalFeatureList<SIFTGeoKeypoint> sgkeys = SIFTGeoKeypoint.read(file);
      final LocalFeatureList<Keypoint> keys = new MemoryLocalFeatureList<Keypoint>(128, sgkeys.size());
      for (final SIFTGeoKeypoint sg : sgkeys) {
        final Keypoint k = new Keypoint();
        k.ivec = sg.descriptor;
        k.x = sg.location.x;
        k.y = sg.location.y;
        k.ori = sg.location.orientation;
        k.scale = sg.location.scale;
        keys.add(k);
      }
      final File path = new File(file.getAbsolutePath()
          .replace(inDir.getAbsolutePath(), outDir.getAbsolutePath())
          .replace(".siftgeo", ".sift"));
      path.getParentFile().mkdirs();
      IOUtils.writeBinary(path, keys);
    } catch (final IOException e) {
      e.printStackTrace();
    }
  }
});

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

@Override
  public void perform(File file) {
    try {
      System.out.println(file);
      final LocalFeatureList<SIFTGeoKeypoint> sgkeys = SIFTGeoKeypoint.read(file);
      final LocalFeatureList<Keypoint> keys = new MemoryLocalFeatureList<Keypoint>(128, sgkeys.size());
      for (final SIFTGeoKeypoint sg : sgkeys) {
        final Keypoint k = new Keypoint();
        k.ivec = sg.descriptor;
        k.x = sg.location.x;
        k.y = sg.location.y;
        k.ori = sg.location.orientation;
        k.scale = sg.location.scale;
        keys.add(k);
      }
      final File path = new File(file.getAbsolutePath()
          .replace(inDir.getAbsolutePath(), outDir.getAbsolutePath())
          .replace(".siftgeo", ".sift"));
      path.getParentFile().mkdirs();
      IOUtils.writeBinary(path, keys);
    } catch (final IOException e) {
      e.printStackTrace();
    }
  }
});

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

protected boolean checkSingularity() {
  float [] centroid = getCentroid();
  Keypoint k = new Keypoint();
  k.y = centroid[1];
  k.x = centroid[0];
  
  for (Pair<T> p : consistentMatches) {
    if (euclideanSqr(p.secondObject(), k) > singularityDistance) return false;
  }
  return true;
}

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

protected boolean checkSingularity() {
  float [] centroid = getCentroid();
  Keypoint k = new Keypoint();
  k.y = centroid[1];
  k.x = centroid[0];
  
  for (Pair<T> p : consistentMatches) {
    if (euclideanSqr(p.secondObject(), k) > singularityDistance) return false;
  }
  return true;
}

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

final Keypoint lbound = new Keypoint();
final Keypoint ubound = new Keypoint();

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

if (image == null) image = loadCorrespondingImage(featureFile);
Keypoint key = new Keypoint();
key.y = kpt.location.y;
key.x = kpt.location.x;

代码示例来源: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/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());
}

相关文章