Home OpenCV CPP code example for describing and matching MSER regions
Reply: 0

OpenCV CPP code example for describing and matching MSER regions

user1202
1#
user1202 Published in April 25, 2018, 12:51 am

I want to use MSER features for matching two images. Opencv documentations have code examples for SIFT feature based matching here. Is there a similar example using MSER class ? I understand that MSER detect regions instead of points like in SIFT. I have the below code that detects the MSER regions for one image. But, once I detect such regions for two images, how to I match them? I do not know how to describe the regions and how to do a match between two images. Please help me out to add code to perform these operations.

#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include "opencv2/features2d/features2d.hpp"
#include <iostream>

using namespace cv;
using namespace std;

int main(int argc, char *argv[])
{
    Mat img = imread(argv[1], 1);

    Ptr<MSER> ms = MSER::create();
    vector<vector<Point> > regions;
    vector<cv::Rect> mser_bbox;
    ms->detectRegions(img, regions, mser_bbox);

    for (int i = 0; i < regions.size(); i++)
    {
        rectangle(img, mser_bbox[i], CV_RGB(0, 255, 0));  
    }

    imshow("mser", img);
    waitKey(0);
    return 0;
}
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.314699 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO