Java Code Examples for org.opencv.core.DMatch

The following are top voted examples for showing how to use org.opencv.core.DMatch. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: opencv-documentscanner-android   File: Converters.java   View source code 5 votes vote down vote up
public static void Mat_to_vector_DMatch(Mat m, List<DMatch> matches) {
    if (matches == null)
        throw new java.lang.IllegalArgumentException("Output List can't be null");
    int count = m.rows();
    if (CvType.CV_64FC4 != m.type() || m.cols() != 1)
        throw new java.lang.IllegalArgumentException(
                "CvType.CV_64FC4 != m.type() ||  m.cols()!=1\n" + m);

    matches.clear();
    double[] buff = new double[4 * count];
    m.get(0, 0, buff);
    for (int i = 0; i < count; i++) {
        matches.add(new DMatch((int) buff[4 * i], (int) buff[4 * i + 1], (int) buff[4 * i + 2], (float) buff[4 * i + 3]));
    }
}
 
Example 2
Project: MOAAP   File: Converters.java   View source code 5 votes vote down vote up
public static void Mat_to_vector_DMatch(Mat m, List<DMatch> matches) {
    if (matches == null)
        throw new java.lang.IllegalArgumentException("Output List can't be null");
    int count = m.rows();
    if (CvType.CV_64FC4 != m.type() || m.cols() != 1)
        throw new java.lang.IllegalArgumentException(
                "CvType.CV_64FC4 != m.type() ||  m.cols()!=1\n" + m);

    matches.clear();
    double[] buff = new double[4 * count];
    m.get(0, 0, buff);
    for (int i = 0; i < count; i++) {
        matches.add(new DMatch((int) buff[4 * i], (int) buff[4 * i + 1], (int) buff[4 * i + 2], (float) buff[4 * i + 3]));
    }
}
 
Example 3
Project: opencv-documentscanner-android   File: MatOfDMatch.java   View source code 5 votes vote down vote up
public void fromArray(DMatch...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++) {
        DMatch m = a[i];
        buff[_channels*i+0] = m.queryIdx;
        buff[_channels*i+1] = m.trainIdx;
        buff[_channels*i+2] = m.imgIdx;
        buff[_channels*i+3] = m.distance;
    }
    put(0, 0, buff); //TODO: check ret val!
}
 
Example 4
Project: opencv-documentscanner-android   File: MatOfDMatch.java   View source code 5 votes vote down vote up
public DMatch[] toArray() {
    int num = (int) total();
    DMatch[] a = new DMatch[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 DMatch((int) buff[_channels*i+0], (int) buff[_channels*i+1], (int) buff[_channels*i+2], buff[_channels*i+3]);
    return a;
}
 
Example 5
Project: NotifyTools   File: Converters.java   View source code 5 votes vote down vote up
public static void Mat_to_vector_DMatch(Mat m, List<DMatch> matches) {
    if (matches == null)
        throw new java.lang.IllegalArgumentException("Output List can't be null");
    int count = m.rows();
    if (CvType.CV_64FC4 != m.type() || m.cols() != 1)
        throw new java.lang.IllegalArgumentException(
                "CvType.CV_64FC4 != m.type() ||  m.cols()!=1\n" + m);

    matches.clear();
    double[] buff = new double[4 * count];
    m.get(0, 0, buff);
    for (int i = 0; i < count; i++) {
        matches.add(new DMatch((int) buff[4 * i], (int) buff[4 * i + 1], (int) buff[4 * i + 2], (float) buff[4 * i + 3]));
    }
}
 
Example 6
Project: NotifyTools   File: MatOfDMatch.java   View source code 5 votes vote down vote up
public void fromArray(DMatch...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++) {
        DMatch m = a[i];
        buff[_channels*i+0] = m.queryIdx;
        buff[_channels*i+1] = m.trainIdx;
        buff[_channels*i+2] = m.imgIdx;
        buff[_channels*i+3] = m.distance;
    }
    put(0, 0, buff); //TODO: check ret val!
}
 
Example 7
Project: fingerblox   File: Converters.java   View source code 5 votes vote down vote up
public static void Mat_to_vector_DMatch(Mat m, List<DMatch> matches) {
    if (matches == null)
        throw new java.lang.IllegalArgumentException("Output List can't be null");
    int count = m.rows();
    if (CvType.CV_64FC4 != m.type() || m.cols() != 1)
        throw new java.lang.IllegalArgumentException(
                "CvType.CV_64FC4 != m.type() ||  m.cols()!=1\n" + m);

    matches.clear();
    double[] buff = new double[4 * count];
    m.get(0, 0, buff);
    for (int i = 0; i < count; i++) {
        matches.add(new DMatch((int) buff[4 * i], (int) buff[4 * i + 1], (int) buff[4 * i + 2], (float) buff[4 * i + 3]));
    }
}
 
Example 8
Project: react-native-scan-doc   File: MatOfDMatch.java   View source code 5 votes vote down vote up
public void fromArray(DMatch...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++) {
        DMatch m = a[i];
        buff[_channels*i+0] = m.queryIdx;
        buff[_channels*i+1] = m.trainIdx;
        buff[_channels*i+2] = m.imgIdx;
        buff[_channels*i+3] = m.distance;
    }
    put(0, 0, buff); //TODO: check ret val!
}
 
Example 9
Project: MOAAP   File: Converters.java   View source code 5 votes vote down vote up
public static void Mat_to_vector_DMatch(Mat m, List<DMatch> matches) {
    if (matches == null)
        throw new java.lang.IllegalArgumentException("Output List can't be null");
    int count = m.rows();
    if (CvType.CV_64FC4 != m.type() || m.cols() != 1)
        throw new java.lang.IllegalArgumentException(
                "CvType.CV_64FC4 != m.type() ||  m.cols()!=1\n" + m);

    matches.clear();
    double[] buff = new double[4 * count];
    m.get(0, 0, buff);
    for (int i = 0; i < count; i++) {
        matches.add(new DMatch((int) buff[4 * i], (int) buff[4 * i + 1], (int) buff[4 * i + 2], (float) buff[4 * i + 3]));
    }
}
 
Example 10
Project: Android-Code-Demos   File: Converters.java   View source code 5 votes vote down vote up
public static void Mat_to_vector_DMatch(Mat m, List<DMatch> matches) {
    if (matches == null)
        throw new java.lang.IllegalArgumentException("Output List can't be null");
    int count = m.rows();
    if (CvType.CV_64FC4 != m.type() || m.cols() != 1)
        throw new java.lang.IllegalArgumentException(
                "CvType.CV_64FC4 != m.type() ||  m.cols()!=1\n" + m);

    matches.clear();
    double[] buff = new double[4 * count];
    m.get(0, 0, buff);
    for (int i = 0; i < count; i++) {
        matches.add(new DMatch((int) buff[4 * i], (int) buff[4 * i + 1], (int) buff[4 * i + 2], (float) buff[4 * i + 3]));
    }
}
 
Example 11
Project: react-native-scan-doc   File: MatOfDMatch.java   View source code 5 votes vote down vote up
public void fromArray(DMatch...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++) {
        DMatch m = a[i];
        buff[_channels*i+0] = m.queryIdx;
        buff[_channels*i+1] = m.trainIdx;
        buff[_channels*i+2] = m.imgIdx;
        buff[_channels*i+3] = m.distance;
    }
    put(0, 0, buff); //TODO: check ret val!
}
 
Example 12
Project: Android-Code-Demos   File: MatOfDMatch.java   View source code 5 votes vote down vote up
public DMatch[] toArray() {
    int num = (int) total();
    DMatch[] a = new DMatch[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 DMatch((int) buff[_channels*i+0], (int) buff[_channels*i+1], (int) buff[_channels*i+2], buff[_channels*i+3]);
    return a;
}
 
Example 13
Project: OpenCV   File: Converters.java   View source code 5 votes vote down vote up
public static void Mat_to_vector_DMatch(Mat m, List<DMatch> matches) {
    if (matches == null)
        throw new java.lang.IllegalArgumentException("Output List can't be null");
    int count = m.rows();
    if (CvType.CV_64FC4 != m.type() || m.cols() != 1)
        throw new java.lang.IllegalArgumentException(
                "CvType.CV_64FC4 != m.type() ||  m.cols()!=1\n" + m);

    matches.clear();
    double[] buff = new double[4 * count];
    m.get(0, 0, buff);
    for (int i = 0; i < count; i++) {
        matches.add(new DMatch((int) buff[4 * i], (int) buff[4 * i + 1], (int) buff[4 * i + 2], (float) buff[4 * i + 3]));
    }
}
 
Example 14
Project: OpenCV   File: MatOfDMatch.java   View source code 5 votes vote down vote up
public void fromArray(DMatch...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++) {
        DMatch m = a[i];
        buff[_channels*i+0] = m.queryIdx;
        buff[_channels*i+1] = m.trainIdx;
        buff[_channels*i+2] = m.imgIdx;
        buff[_channels*i+3] = m.distance;
    }
    put(0, 0, buff); //TODO: check ret val!
}
 
Example 15
Project: OpenCV   File: MatOfDMatch.java   View source code 5 votes vote down vote up
public DMatch[] toArray() {
    int num = (int) total();
    DMatch[] a = new DMatch[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 DMatch((int) buff[_channels*i+0], (int) buff[_channels*i+1], (int) buff[_channels*i+2], buff[_channels*i+3]);
    return a;
}
 
Example 16
Project: Team9261-2017-2018   File: Converters.java   View source code 5 votes vote down vote up
public static void Mat_to_vector_DMatch(Mat m, List<DMatch> matches) {
    if (matches == null)
        throw new java.lang.IllegalArgumentException("Output List can't be null");
    int count = m.rows();
    if (CvType.CV_64FC4 != m.type() || m.cols() != 1)
        throw new java.lang.IllegalArgumentException(
                "CvType.CV_64FC4 != m.type() ||  m.cols()!=1\n" + m);

    matches.clear();
    double[] buff = new double[4 * count];
    m.get(0, 0, buff);
    for (int i = 0; i < count; i++) {
        matches.add(new DMatch((int) buff[4 * i], (int) buff[4 * i + 1], (int) buff[4 * i + 2], (float) buff[4 * i + 3]));
    }
}
 
Example 17
Project: react-native-scan-doc   File: MatOfDMatch.java   View source code 5 votes vote down vote up
public DMatch[] toArray() {
    int num = (int) total();
    DMatch[] a = new DMatch[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 DMatch((int) buff[_channels*i+0], (int) buff[_channels*i+1], (int) buff[_channels*i+2], buff[_channels*i+3]);
    return a;
}
 
Example 18
Project: mao-android   File: MatOfDMatch.java   View source code 5 votes vote down vote up
public DMatch[] toArray() {
    int num = (int) total();
    DMatch[] a = new DMatch[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 DMatch((int) buff[_channels*i+0], (int) buff[_channels*i+1], (int) buff[_channels*i+2], buff[_channels*i+3]);
    return a;
}
 
Example 19
Project: Microsphere   File: MatOfDMatch.java   View source code 5 votes vote down vote up
public DMatch[] toArray() {
    int num = (int) total();
    DMatch[] a = new DMatch[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 DMatch((int) buff[_channels*i+0], (int) buff[_channels*i+1], (int) buff[_channels*i+2], buff[_channels*i+3]);
    return a;
}
 
Example 20
Project: DogeCV   File: Converters.java   View source code 5 votes vote down vote up
public static void Mat_to_vector_DMatch(Mat m, List<DMatch> matches) {
    if (matches == null)
        throw new java.lang.IllegalArgumentException("Output List can't be null");
    int count = m.rows();
    if (CvType.CV_64FC4 != m.type() || m.cols() != 1)
        throw new java.lang.IllegalArgumentException(
                "CvType.CV_64FC4 != m.type() ||  m.cols()!=1\n" + m);

    matches.clear();
    double[] buff = new double[4 * count];
    m.get(0, 0, buff);
    for (int i = 0; i < count; i++) {
        matches.add(new DMatch((int) buff[4 * i], (int) buff[4 * i + 1], (int) buff[4 * i + 2], (float) buff[4 * i + 3]));
    }
}
 
Example 21
Project: DNNLibrary   File: MatOfDMatch.java   View source code 5 votes vote down vote up
public void fromArray(DMatch...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++) {
        DMatch m = a[i];
        buff[_channels*i+0] = m.queryIdx;
        buff[_channels*i+1] = m.trainIdx;
        buff[_channels*i+2] = m.imgIdx;
        buff[_channels*i+3] = m.distance;
    }
    put(0, 0, buff); //TODO: check ret val!
}
 
Example 22
Project: Sikulix2opencv   File: MatOfDMatch.java   View source code 5 votes vote down vote up
public void fromArray(DMatch...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++) {
        DMatch m = a[i];
        buff[_channels*i+0] = m.queryIdx;
        buff[_channels*i+1] = m.trainIdx;
        buff[_channels*i+2] = m.imgIdx;
        buff[_channels*i+3] = m.distance;
    }
    put(0, 0, buff); //TODO: check ret val!
}
 
Example 23
Project: Sikulix2opencv   File: Converters.java   View source code 5 votes vote down vote up
public static void Mat_to_vector_DMatch(Mat m, List<DMatch> matches) {
    if (matches == null)
        throw new java.lang.IllegalArgumentException("Output List can't be null");
    int count = m.rows();
    if (CvType.CV_64FC4 != m.type() || m.cols() != 1)
        throw new java.lang.IllegalArgumentException(
                "CvType.CV_64FC4 != m.type() ||  m.cols()!=1\n" + m);

    matches.clear();
    double[] buff = new double[4 * count];
    m.get(0, 0, buff);
    for (int i = 0; i < count; i++) {
        matches.add(new DMatch((int) buff[4 * i], (int) buff[4 * i + 1], (int) buff[4 * i + 2], (float) buff[4 * i + 3]));
    }
}
 
Example 24
Project: renderscript_examples   File: MatOfDMatch.java   View source code 5 votes vote down vote up
public void fromArray(DMatch...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++) {
        DMatch m = a[i];
        buff[_channels*i+0] = m.queryIdx;
        buff[_channels*i+1] = m.trainIdx;
        buff[_channels*i+2] = m.imgIdx;
        buff[_channels*i+3] = m.distance;
    }
    put(0, 0, buff); //TODO: check ret val!
}
 
Example 25
Project: renderscript_examples   File: Converters.java   View source code 5 votes vote down vote up
public static void Mat_to_vector_DMatch(Mat m, List<DMatch> matches) {
    if (matches == null)
        throw new java.lang.IllegalArgumentException("Output List can't be null");
    int count = m.rows();
    if (CvType.CV_64FC4 != m.type() || m.cols() != 1)
        throw new java.lang.IllegalArgumentException(
                "CvType.CV_64FC4 != m.type() ||  m.cols()!=1\n" + m);

    matches.clear();
    double[] buff = new double[4 * count];
    m.get(0, 0, buff);
    for (int i = 0; i < count; i++) {
        matches.add(new DMatch((int) buff[4 * i], (int) buff[4 * i + 1], (int) buff[4 * i + 2], (float) buff[4 * i + 3]));
    }
}
 
Example 26
Project: FTC2016   File: MatOfDMatch.java   View source code 5 votes vote down vote up
public DMatch[] toArray() {
    int num = (int) total();
    DMatch[] a = new DMatch[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 DMatch((int) buff[_channels*i+0], (int) buff[_channels*i+1], (int) buff[_channels*i+2], buff[_channels*i+3]);
    return a;
}
 
Example 27
Project: Checkerboard-IMU-Comparator   File: MatOfDMatch.java   View source code 5 votes vote down vote up
public DMatch[] toArray() {
    int num = (int) total();
    DMatch[] a = new DMatch[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 DMatch((int) buff[_channels*i+0], (int) buff[_channels*i+1], (int) buff[_channels*i+2], buff[_channels*i+3]);
    return a;
}
 
Example 28
Project: MOAAP   File: MatOfDMatch.java   View source code 5 votes vote down vote up
public void fromArray(DMatch...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++) {
        DMatch m = a[i];
        buff[_channels*i+0] = m.queryIdx;
        buff[_channels*i+1] = m.trainIdx;
        buff[_channels*i+2] = m.imgIdx;
        buff[_channels*i+3] = m.distance;
    }
    put(0, 0, buff); //TODO: check ret val!
}
 
Example 29
Project: Image-Detection-Samples   File: Converters.java   View source code 5 votes vote down vote up
public static void Mat_to_vector_DMatch(Mat m, List<DMatch> matches) {
    if (matches == null)
        throw new java.lang.IllegalArgumentException("Output List can't be null");
    int count = m.rows();
    if (CvType.CV_64FC4 != m.type() || m.cols() != 1)
        throw new java.lang.IllegalArgumentException(
                "CvType.CV_64FC4 != m.type() ||  m.cols()!=1\n" + m);

    matches.clear();
    double[] buff = new double[4 * count];
    m.get(0, 0, buff);
    for (int i = 0; i < count; i++) {
        matches.add(new DMatch((int) buff[4 * i], (int) buff[4 * i + 1], (int) buff[4 * i + 2], (float) buff[4 * i + 3]));
    }
}
 
Example 30
Project: Image-Detection-Samples   File: MatOfDMatch.java   View source code 5 votes vote down vote up
public void fromArray(DMatch...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++) {
        DMatch m = a[i];
        buff[_channels*i+0] = m.queryIdx;
        buff[_channels*i+1] = m.trainIdx;
        buff[_channels*i+2] = m.imgIdx;
        buff[_channels*i+3] = m.distance;
    }
    put(0, 0, buff); //TODO: check ret val!
}
 
Example 31
Project: Image-Detection-Samples   File: MatOfDMatch.java   View source code 5 votes vote down vote up
public DMatch[] toArray() {
    int num = (int) total();
    DMatch[] a = new DMatch[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 DMatch((int) buff[_channels*i+0], (int) buff[_channels*i+1], (int) buff[_channels*i+2], buff[_channels*i+3]);
    return a;
}
 
Example 32
Project: react-native-scan-doc   File: Converters.java   View source code 5 votes vote down vote up
public static void Mat_to_vector_DMatch(Mat m, List<DMatch> matches) {
    if (matches == null)
        throw new java.lang.IllegalArgumentException("Output List can't be null");
    int count = m.rows();
    if (CvType.CV_64FC4 != m.type() || m.cols() != 1)
        throw new java.lang.IllegalArgumentException(
                "CvType.CV_64FC4 != m.type() ||  m.cols()!=1\n" + m);

    matches.clear();
    double[] buff = new double[4 * count];
    m.get(0, 0, buff);
    for (int i = 0; i < count; i++) {
        matches.add(new DMatch((int) buff[4 * i], (int) buff[4 * i + 1], (int) buff[4 * i + 2], (float) buff[4 * i + 3]));
    }
}
 
Example 33
Project: Ftc2018RelicRecovery   File: Converters.java   View source code 5 votes vote down vote up
public static void Mat_to_vector_DMatch(Mat m, List<DMatch> matches) {
    if (matches == null)
        throw new java.lang.IllegalArgumentException("Output List can't be null");
    int count = m.rows();
    if (CvType.CV_64FC4 != m.type() || m.cols() != 1)
        throw new java.lang.IllegalArgumentException(
                "CvType.CV_64FC4 != m.type() ||  m.cols()!=1\n" + m);

    matches.clear();
    double[] buff = new double[4 * count];
    m.get(0, 0, buff);
    for (int i = 0; i < count; i++) {
        matches.add(new DMatch((int) buff[4 * i], (int) buff[4 * i + 1], (int) buff[4 * i + 2], (float) buff[4 * i + 3]));
    }
}
 
Example 34
Project: DNNLibrary   File: Converters.java   View source code 5 votes vote down vote up
public static void Mat_to_vector_DMatch(Mat m, List<DMatch> matches) {
    if (matches == null)
        throw new java.lang.IllegalArgumentException("Output List can't be null");
    int count = m.rows();
    if (CvType.CV_64FC4 != m.type() || m.cols() != 1)
        throw new java.lang.IllegalArgumentException(
                "CvType.CV_64FC4 != m.type() ||  m.cols()!=1\n" + m);

    matches.clear();
    double[] buff = new double[4 * count];
    m.get(0, 0, buff);
    for (int i = 0; i < count; i++) {
        matches.add(new DMatch((int) buff[4 * i], (int) buff[4 * i + 1], (int) buff[4 * i + 2], (float) buff[4 * i + 3]));
    }
}
 
Example 35
Project: EyeShopping   File: Converters.java   View source code 5 votes vote down vote up
public static void Mat_to_vector_DMatch(Mat m, List<DMatch> matches) {
    if (matches == null)
        throw new java.lang.IllegalArgumentException("Output List can't be null");
    int count = m.rows();
    if (CvType.CV_64FC4 != m.type() || m.cols() != 1)
        throw new java.lang.IllegalArgumentException(
                "CvType.CV_64FC4 != m.type() ||  m.cols()!=1\n" + m);

    matches.clear();
    double[] buff = new double[4 * count];
    m.get(0, 0, buff);
    for (int i = 0; i < count; i++) {
        matches.add(new DMatch((int) buff[4 * i], (int) buff[4 * i + 1], (int) buff[4 * i + 2], (float) buff[4 * i + 3]));
    }
}
 
Example 36
Project: FaceDetectDemo   File: MatOfDMatch.java   View source code 5 votes vote down vote up
public void fromArray(DMatch...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++) {
        DMatch m = a[i];
        buff[_channels*i+0] = m.queryIdx;
        buff[_channels*i+1] = m.trainIdx;
        buff[_channels*i+2] = m.imgIdx;
        buff[_channels*i+3] = m.distance;
    }
    put(0, 0, buff); //TODO: check ret val!
}
 
Example 37
Project: FaceDetectDemo   File: MatOfDMatch.java   View source code 5 votes vote down vote up
public DMatch[] toArray() {
    int num = (int) total();
    DMatch[] a = new DMatch[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 DMatch((int) buff[_channels*i+0], (int) buff[_channels*i+1], (int) buff[_channels*i+2], buff[_channels*i+3]);
    return a;
}
 
Example 38
Project: Sikulix2opencv   File: MatOfDMatch.java   View source code 5 votes vote down vote up
public DMatch[] toArray() {
    int num = (int) total();
    DMatch[] a = new DMatch[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 DMatch((int) buff[_channels*i+0], (int) buff[_channels*i+1], (int) buff[_channels*i+2], buff[_channels*i+3]);
    return a;
}
 
Example 39
Project: RobotIGS   File: Converters.java   View source code 5 votes vote down vote up
public static void Mat_to_vector_DMatch(Mat m, List<DMatch> matches) {
    if (matches == null)
        throw new java.lang.IllegalArgumentException("Output List can't be null");
    int count = m.rows();
    if (CvType.CV_64FC4 != m.type() || m.cols() != 1)
        throw new java.lang.IllegalArgumentException(
                "CvType.CV_64FC4 != m.type() ||  m.cols()!=1\n" + m);

    matches.clear();
    double[] buff = new double[4 * count];
    m.get(0, 0, buff);
    for (int i = 0; i < count; i++) {
        matches.add(new DMatch((int) buff[4 * i], (int) buff[4 * i + 1], (int) buff[4 * i + 2], (float) buff[4 * i + 3]));
    }
}
 
Example 40
Project: RobotIGS   File: MatOfDMatch.java   View source code 5 votes vote down vote up
public void fromArray(DMatch...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++) {
        DMatch m = a[i];
        buff[_channels*i+0] = m.queryIdx;
        buff[_channels*i+1] = m.trainIdx;
        buff[_channels*i+2] = m.imgIdx;
        buff[_channels*i+3] = m.distance;
    }
    put(0, 0, buff); //TODO: check ret val!
}