Why does Python implementation and Java implementation of OpenCV’s MSER create different output?

You are using two different interfaces to the MSER implementation.

Python cv2.MSER gives you a wrapped cv::MSER, which exposes its operator() to Python as detect:

//! the operator that extracts the MSERs from the image or the specific part of it
CV_WRAP_AS(detect) void operator()( const Mat& image, CV_OUT vector<vector<Point> >& msers,
                                    const Mat& mask=Mat() ) const;

This gives you the nice list of contours interface you are looking for.

In contrast Java uses the javaFeatureDetector wrapper which calls FeatureDetector::detect which is backed by MSER::detectImpl and uses the standard FeatureDetector interface: a list of KeyPoints.

If you want to access the operator() in Java (in OpenCV 2.4) you will have to wrap it up in JNI.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)