当前位置: 首页>>代码示例>>Java>>正文


Java KeyPoint类代码示例

本文整理汇总了Java中org.opencv.features2d.KeyPoint的典型用法代码示例。如果您正苦于以下问题:Java KeyPoint类的具体用法?Java KeyPoint怎么用?Java KeyPoint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


KeyPoint类属于org.opencv.features2d包,在下文中一共展示了KeyPoint类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Mat_to_vector_KeyPoint

import org.opencv.features2d.KeyPoint; //导入依赖的package包/类
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]));
    }
}
 
开发者ID:hollaus,项目名称:TinyPlanetMaker,代码行数:17,代码来源:Converters.java

示例2: fromArray

import org.opencv.features2d.KeyPoint; //导入依赖的package包/类
public void fromArray(KeyPoint...a) {
    if(a==null || a.length==0)
        return;
    int num = a.length;
    alloc(num);
    float buff[] = new float[num * _channels];
    for(int i=0; i<num; i++) {
        KeyPoint kp = a[i];
        buff[_channels*i+0] = (float) kp.pt.x;
        buff[_channels*i+1] = (float) kp.pt.y;
        buff[_channels*i+2] = kp.size;
        buff[_channels*i+3] = kp.angle;
        buff[_channels*i+4] = kp.response;
        buff[_channels*i+5] = kp.octave;
        buff[_channels*i+6] = kp.class_id;
    }
    put(0, 0, buff); //TODO: check ret val!
}
 
开发者ID:hollaus,项目名称:TinyPlanetMaker,代码行数:19,代码来源:MatOfKeyPoint.java

示例3: vector_KeyPoint_to_Mat

import org.opencv.features2d.KeyPoint; //导入依赖的package包/类
public static Mat vector_KeyPoint_to_Mat(List<KeyPoint> kps) {
    Mat res;
    int count = (kps != null) ? kps.size() : 0;
    if (count > 0) {
        res = new Mat(count, 1, CvType.CV_64FC(7));
        double[] buff = new double[count * 7];
        for (int i = 0; i < count; i++) {
            KeyPoint kp = kps.get(i);
            buff[7 * i] = kp.pt.x;
            buff[7 * i + 1] = kp.pt.y;
            buff[7 * i + 2] = kp.size;
            buff[7 * i + 3] = kp.angle;
            buff[7 * i + 4] = kp.response;
            buff[7 * i + 5] = kp.octave;
            buff[7 * i + 6] = kp.class_id;
        }
        res.put(0, 0, buff);
    } else {
        res = new Mat();
    }
    return res;
}
 
开发者ID:rustielin,项目名称:MemeVision,代码行数:23,代码来源:Converters.java


注:本文中的org.opencv.features2d.KeyPoint类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。