Example usage for org.opencv.core MatOfDMatch row

List of usage examples for org.opencv.core MatOfDMatch row

Introduction

In this page you can find the example usage for org.opencv.core MatOfDMatch row.

Prototype

public Mat row(int y) 

Source Link

Usage

From source file:OCV_FeatureDetection.java

License:Open Source License

private MatOfDMatch showData(MatOfKeyPoint key_query, MatOfKeyPoint key_train, MatOfDMatch dmatch) {
    MatOfDMatch output = new MatOfDMatch();
    int num = dmatch.rows();
    float[] ele_dmatch = new float[4];

    ResultsTable rt = OCV__LoadLibrary.GetResultsTable(true);

    for (int i = 0; i < num; i++) {
        dmatch.get(i, 0, ele_dmatch);/*from  w  w  w. j a  v a 2  s.co m*/

        if (ele_dmatch[3] <= max_distance) {
            output.push_back(dmatch.row(i));

            int queryidx = (int) ele_dmatch[0];
            int trainidx = (int) ele_dmatch[1];
            float distance = ele_dmatch[3];

            double x_query = key_query.get(queryidx, 0)[0];
            double y_query = key_query.get(queryidx, 0)[1];
            double x_train = key_train.get(trainidx, 0)[0];
            double y_train = key_train.get(trainidx, 0)[1];

            rt.incrementCounter();
            rt.addValue("x_query", x_query);
            rt.addValue("y_query", y_query);
            rt.addValue("x_train", x_train);
            rt.addValue("y_train", y_train);
            rt.addValue("distance", distance);
            rt.show("Results");
        }
    }

    return output;
}