org.opencv.features2d.KeyPoint类的使用及代码示例

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

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

KeyPoint介绍

[英]Data structure for salient point detectors.

coordinates of the keypoint

diameter of the meaningful keypoint neighborhood ``

// C++ code:

computed orientation of the keypoint (-1 if not applicable). Its possible values are in a range [0,360) degrees. It is measured relative to image coordinate system (y-axis is directed downward), ie in clockwise.

the response by which the most strong keypoints have been selected. Can be used for further sorting or subsampling

octave (pyramid layer) from which the keypoint has been extracted

object id that can be used to clustered keypoints by an object they belong to
[中]突出点探测器的数据结构。
关键点坐标
有意义的关键点邻域的直径``
//C++代码:
关键点的计算方向(-1,如果不适用)。它的可能值在[0360)度范围内。它是相对于图像坐标系(y轴向下)测量的,即顺时针方向。
选择最强关键点的响应。可用于进一步排序或二次采样
从中提取关键点的倍频程(金字塔层)
可由关键点所属的对象用于聚集关键点的对象id

代码示例

代码示例来源:origin: com.sikulix/sikulixapi

public KeyPoint[] toArray() {
  int num = (int) total();
  KeyPoint[] a = new KeyPoint[num];
  if(num == 0)
    return a;
  float buff[] = new float[num * _channels];
  get(0, 0, buff); //TODO: check ret val!
  for(int i=0; i<num; i++)
    a[i] = new KeyPoint( buff[_channels*i+0], buff[_channels*i+1], buff[_channels*i+2], buff[_channels*i+3],
               buff[_channels*i+4], (int) buff[_channels*i+5], (int) buff[_channels*i+6] );
  return a;
}

代码示例来源:origin: ytai/IOIOPlotter

public KeyPoint[] toArray() {
  int num = (int) total();
  KeyPoint[] a = new KeyPoint[num];
  if(num == 0)
    return a;
  float buff[] = new float[num * _channels];
  get(0, 0, buff); //TODO: check ret val!
  for(int i=0; i<num; i++)
    a[i] = new KeyPoint( buff[_channels*i+0], buff[_channels*i+1], buff[_channels*i+2], buff[_channels*i+3],
               buff[_channels*i+4], (int) buff[_channels*i+5], (int) buff[_channels*i+6] );
  return a;
}

代码示例来源:origin: nu.pattern/opencv

public KeyPoint[] toArray() {
  int num = (int) total();
  KeyPoint[] a = new KeyPoint[num];
  if(num == 0)
    return a;
  float buff[] = new float[num * _channels];
  get(0, 0, buff); //TODO: check ret val!
  for(int i=0; i<num; i++)
    a[i] = new KeyPoint( buff[_channels*i+0], buff[_channels*i+1], buff[_channels*i+2], buff[_channels*i+3],
               buff[_channels*i+4], (int) buff[_channels*i+5], (int) buff[_channels*i+6] );
  return a;
}

代码示例来源:origin: abhn/marvel

public KeyPoint[] toArray() {
  int num = (int) total();
  KeyPoint[] a = new KeyPoint[num];
  if(num == 0)
    return a;
  float buff[] = new float[num * _channels];
  get(0, 0, buff); //TODO: check ret val!
  for(int i=0; i<num; i++)
    a[i] = new KeyPoint( buff[_channels*i+0], buff[_channels*i+1], buff[_channels*i+2], buff[_channels*i+3],
               buff[_channels*i+4], (int) buff[_channels*i+5], (int) buff[_channels*i+6] );
  return a;
}

代码示例来源:origin: jtsky/EasyPR_Android

public KeyPoint[] toArray() {
  int num = (int) total();
  KeyPoint[] a = new KeyPoint[num];
  if(num == 0)
    return a;
  float buff[] = new float[num * _channels];
  get(0, 0, buff); //TODO: check ret val!
  for(int i=0; i<num; i++)
    a[i] = new KeyPoint( buff[_channels*i+0], buff[_channels*i+1], buff[_channels*i+2], buff[_channels*i+3],
               buff[_channels*i+4], (int) buff[_channels*i+5], (int) buff[_channels*i+6] );
  return a;
}

代码示例来源:origin: stackoverflow.com

import com.googlecode.javacv.cpp.opencv_core.CvMat;
import com.googlecode.javacv.cpp.opencv_features2d.FeatureDetector;
import com.googlecode.javacv.cpp.opencv_features2d.KeyPoint;
import com.googlecode.javacv.cpp.opencv_nonfree.SIFT;

import static com.googlecode.javacv.cpp.opencv_highgui.cvLoadImageM;
public class any {
public static void main(String args[])
{
final CvMat image1 = cvLoadImageM("C:/temp/316.jpg" , 0);

  final CvMat image2 = cvLoadImageM("C:/temp/330.jpg", 0);
  if(image1==null)
  System.out.println("image is null");
if(image2==null)
  System.out.println("image is null");

SIFT  sift = new SIFT();
FeatureDetector featureDetector =sift.getFeatureDetector();
KeyPoint keypoint1 = new KeyPoint();
KeyPoint keypoint2 = new KeyPoint() ;
featureDetector.detect(image1, keypoint1 , null);
featureDetector.detect(image2,keypoint2, null);
System.out.println(keypoint1);
}
}

代码示例来源:origin: com.sikulix/sikulixapi

public static void Mat_to_vector_KeyPoint(Mat m, List<KeyPoint> kps) {
  if (kps == null)
    throw new java.lang.IllegalArgumentException("Output List can't be null");
  int count = m.rows();
  if (CvType.CV_64FC(7) != m.type() || m.cols() != 1)
    throw new java.lang.IllegalArgumentException(
        "CvType.CV_64FC(7) != m.type() ||  m.cols()!=1\n" + m);
  kps.clear();
  double[] buff = new double[7 * count];
  m.get(0, 0, buff);
  for (int i = 0; i < count; i++) {
    kps.add(new KeyPoint((float) buff[7 * i], (float) buff[7 * i + 1], (float) buff[7 * i + 2], (float) buff[7 * i + 3],
        (float) buff[7 * i + 4], (int) buff[7 * i + 5], (int) buff[7 * i + 6]));
  }
}

代码示例来源:origin: abhn/marvel

public static void Mat_to_vector_KeyPoint(Mat m, List<KeyPoint> kps) {
  if (kps == null)
    throw new java.lang.IllegalArgumentException("Output List can't be null");
  int count = m.rows();
  if (CvType.CV_64FC(7) != m.type() || m.cols() != 1)
    throw new java.lang.IllegalArgumentException(
        "CvType.CV_64FC(7) != m.type() ||  m.cols()!=1\n" + m);
  kps.clear();
  double[] buff = new double[7 * count];
  m.get(0, 0, buff);
  for (int i = 0; i < count; i++) {
    kps.add(new KeyPoint((float) buff[7 * i], (float) buff[7 * i + 1], (float) buff[7 * i + 2], (float) buff[7 * i + 3],
        (float) buff[7 * i + 4], (int) buff[7 * i + 5], (int) buff[7 * i + 6]));
  }
}

代码示例来源:origin: nu.pattern/opencv

public static void Mat_to_vector_KeyPoint(Mat m, List<KeyPoint> kps) {
  if (kps == null)
    throw new java.lang.IllegalArgumentException("Output List can't be null");
  int count = m.rows();
  if (CvType.CV_64FC(7) != m.type() || m.cols() != 1)
    throw new java.lang.IllegalArgumentException(
        "CvType.CV_64FC(7) != m.type() ||  m.cols()!=1\n" + m);
  kps.clear();
  double[] buff = new double[7 * count];
  m.get(0, 0, buff);
  for (int i = 0; i < count; i++) {
    kps.add(new KeyPoint((float) buff[7 * i], (float) buff[7 * i + 1], (float) buff[7 * i + 2], (float) buff[7 * i + 3],
        (float) buff[7 * i + 4], (int) buff[7 * i + 5], (int) buff[7 * i + 6]));
  }
}

代码示例来源:origin: ytai/IOIOPlotter

public static void Mat_to_vector_KeyPoint(Mat m, List<KeyPoint> kps) {
  if (kps == null)
    throw new java.lang.IllegalArgumentException("Output List can't be null");
  int count = m.rows();
  if (CvType.CV_64FC(7) != m.type() || m.cols() != 1)
    throw new java.lang.IllegalArgumentException(
        "CvType.CV_64FC(7) != m.type() ||  m.cols()!=1\n" + m);
  kps.clear();
  double[] buff = new double[7 * count];
  m.get(0, 0, buff);
  for (int i = 0; i < count; i++) {
    kps.add(new KeyPoint((float) buff[7 * i], (float) buff[7 * i + 1], (float) buff[7 * i + 2], (float) buff[7 * i + 3],
        (float) buff[7 * i + 4], (int) buff[7 * i + 5], (int) buff[7 * i + 6]));
  }
}

代码示例来源:origin: jtsky/EasyPR_Android

public static void Mat_to_vector_KeyPoint(Mat m, List<KeyPoint> kps) {
  if (kps == null)
    throw new java.lang.IllegalArgumentException("Output List can't be null");
  int count = m.rows();
  if (CvType.CV_64FC(7) != m.type() || m.cols() != 1)
    throw new java.lang.IllegalArgumentException(
        "CvType.CV_64FC(7) != m.type() ||  m.cols()!=1\n" + m);
  kps.clear();
  double[] buff = new double[7 * count];
  m.get(0, 0, buff);
  for (int i = 0; i < count; i++) {
    kps.add(new KeyPoint((float) buff[7 * i], (float) buff[7 * i + 1], (float) buff[7 * i + 2], (float) buff[7 * i + 3],
        (float) buff[7 * i + 4], (int) buff[7 * i + 5], (int) buff[7 * i + 6]));
  }
}

代码示例来源:origin: stackoverflow.com

KeyPoint kp = new KeyPoint();

代码示例来源:origin: stackoverflow.com

KeyPoint kp = new KeyPoint();

代码示例来源:origin: stackoverflow.com

KeyPoint impKeyPoint = new KeyPoint();
  KeyPoint tempKeyPoint = new KeyPoint();
  tempKeyPoint = impKeyPoint;
  tempKeyPoint.size = 120;
  KeyPoint tempKeyPoint = new KeyPoint();
  tempKeyPoint = impKeyPoint;
  tempKeyPoint.size = 120;

相关文章

KeyPoint类方法