org.opencv.core.DMatch Java Examples

The following examples show how to use org.opencv.core.DMatch. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MatOfDMatch.java    From Machine-Learning-Projects-for-Mobile-Applications with MIT License 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 #2
Source File: MatOfDMatch.java    From LPR with Apache License 2.0 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 #3
Source File: Converters.java    From LicensePlateDiscern with MIT License 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 #4
Source File: MatOfDMatch.java    From SmartPaperScan with Apache License 2.0 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
Source File: MatOfDMatch.java    From real_time_circle_detection_android with MIT License 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 #6
Source File: MatOfDMatch.java    From LicensePlateDiscern with MIT License 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
Source File: MatOfDMatch.java    From MOAAP with MIT License 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 #8
Source File: Converters.java    From react-native-documentscanner-android with MIT License 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 #9
Source File: Converters.java    From FaceDetectDemo with Apache License 2.0 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
Source File: MatOfDMatch.java    From react-native-documentscanner-android with MIT License 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 #11
Source File: MatOfDMatch.java    From react-native-documentscanner-android with MIT License 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 #12
Source File: MatOfDMatch.java    From SmartPaperScan with Apache License 2.0 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 #13
Source File: Converters.java    From Machine-Learning-Projects-for-Mobile-Applications with MIT License 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
Source File: MatOfDMatch.java    From Image-Detection-Samples with Apache License 2.0 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 #15
Source File: MatOfDMatch.java    From Image-Detection-Samples with Apache License 2.0 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 #16
Source File: Converters.java    From MOAAP with MIT License 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
Source File: MatOfDMatch.java    From MOAAP with MIT License 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 #18
Source File: Converters.java    From OpenCV-android with Apache License 2.0 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 #19
Source File: MatOfDMatch.java    From OpenCV-android with Apache License 2.0 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 #20
Source File: MatOfDMatch.java    From OpenCV-android with Apache License 2.0 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 #21
Source File: Converters.java    From VIA-AI with MIT License 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 #22
Source File: Converters.java    From OpenCvFaceDetect with Apache License 2.0 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 #23
Source File: Converters.java    From MOAAP with MIT License 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
Source File: MatOfDMatch.java    From OpenCvFaceDetect with Apache License 2.0 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
Source File: MatOfDMatch.java    From OpenCvFaceDetect with Apache License 2.0 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 #26
Source File: MatOfDMatch.java    From opencv-documentscanner-android with Apache License 2.0 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 #27
Source File: MatOfDMatch.java    From MOAAP with MIT License 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
Source File: MatOfDMatch.java    From MOAAP with MIT License 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
Source File: Converters.java    From opencv-documentscanner-android with Apache License 2.0 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
Source File: MatOfDMatch.java    From Chinese-number-gestures-recognition with BSD 2-Clause "Simplified" License 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;
}