Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

what MatOfMatch object is needed for?

I wrote the below code to get a the feeling about the feature detection. but what i could not understand is, why do we need MatOfMatch object, what it is needed for?

Code

public static void main(String[] args) {
    System.loadLibrary(Core.NATIVE_LIBRARY_NAME);

    Mat img_0 = Highgui.imread(PATH_0);
    Mat img_0_rev = Highgui.imread(PATH_1);
    Mat img_output = new Mat();

    FeatureDetector fDetect = FeatureDetector.create(FeatureDetector.SIFT);

    MatOfKeyPoint mKeyPoints_0 = new MatOfKeyPoint();
    fDetect.detect(img_0, mKeyPoints_0);
    System.out.println("mKeyPoint_0: " + mKeyPoints_0.size());

    MatOfKeyPoint mKeyPoints_1 = new MatOfKeyPoint();
    fDetect.detect(img_0_rev, mKeyPoints_1);
    System.out.println("mKeyPoint_1: " + mKeyPoints_1.size());

    MatOfDMatch mDMatch = new MatOfDMatch();

    //Features2d.drawKeypoints(mKeyPoints_0, mKeyPoints_0, outImage, Scalar color, Features2d.DRAW_RICH_KEYPOINTS);
    Features2d.drawMatches(img_0, mKeyPoints_0, img_0_rev, mKeyPoints_1, mDMatch, img_output);

what MatOfMatch object is needed for?

I wrote the below code to get a the feeling about the feature detection. but what i could not understand is, why do we need MatOfMatch object, what it is needed for?

Code

public static void main(String[] args) {
    System.loadLibrary(Core.NATIVE_LIBRARY_NAME);

    Mat img_0 = Highgui.imread(PATH_0);
    Mat img_0_rev = Highgui.imread(PATH_1);
    Mat img_output = new Mat();

    FeatureDetector fDetect = FeatureDetector.create(FeatureDetector.SIFT);

    MatOfKeyPoint mKeyPoints_0 = new MatOfKeyPoint();
    fDetect.detect(img_0, mKeyPoints_0);
    System.out.println("mKeyPoint_0: " + mKeyPoints_0.size());

    MatOfKeyPoint mKeyPoints_1 = new MatOfKeyPoint();
    fDetect.detect(img_0_rev, mKeyPoints_1);
    System.out.println("mKeyPoint_1: " + mKeyPoints_1.size());

    MatOfDMatch mDMatch = new MatOfDMatch();

    //Features2d.drawKeypoints(mKeyPoints_0, mKeyPoints_0, outImage, Scalar color, Features2d.DRAW_RICH_KEYPOINTS);
    Features2d.drawMatches(img_0, mKeyPoints_0, img_0_rev, mKeyPoints_1, mDMatch, img_output);
click to hide/show revision 3
retagged

updated 2015-03-27 09:38:46 -0600

berak gravatar image

what MatOfMatch object is needed for?

I wrote the below code to get a the feeling about the feature detection. but what i could not understand is, why do we need MatOfMatch object, what it is needed for?

Code

public static void main(String[] args) {
    System.loadLibrary(Core.NATIVE_LIBRARY_NAME);

    Mat img_0 = Highgui.imread(PATH_0);
    Mat img_0_rev = Highgui.imread(PATH_1);
    Mat img_output = new Mat();

    FeatureDetector fDetect = FeatureDetector.create(FeatureDetector.SIFT);

    MatOfKeyPoint mKeyPoints_0 = new MatOfKeyPoint();
    fDetect.detect(img_0, mKeyPoints_0);
    System.out.println("mKeyPoint_0: " + mKeyPoints_0.size());

    MatOfKeyPoint mKeyPoints_1 = new MatOfKeyPoint();
    fDetect.detect(img_0_rev, mKeyPoints_1);
    System.out.println("mKeyPoint_1: " + mKeyPoints_1.size());

    MatOfDMatch mDMatch = new MatOfDMatch();

    //Features2d.drawKeypoints(mKeyPoints_0, mKeyPoints_0, outImage, Scalar color, Features2d.DRAW_RICH_KEYPOINTS);
    Features2d.drawMatches(img_0, mKeyPoints_0, img_0_rev, mKeyPoints_1, mDMatch, img_output);