MSER produces different results for android and desktop version [closed]

asked 2015-08-22 04:56:01 -0600

jcrist gravatar image

Hello, all,

It seems like MSER algorithm works differently for desktop and Android version of OpenCV 3.0. The code below produces different results depending on the platform where OpenCV is run (desktop or android):

Mat img = Imgcodecs.imread(filename, Imgcodecs.IMREAD_GRAYSCALE);

MatOfKeyPoint mokp = new MatOfKeyPoint();

FeatureDetector fd = FeatureDetector.create(FeatureDetector.MSER);

fd.detect(img, mokp);

and then System.out.println("Mat of key points = " + mokp.rows() + "x" + mokp.cols()); (for desktop)

or Log.i(TAG, "Mat of key points = " + mokp.rows() + "x" + mokp.cols()); (for android)

This is what I get in logs: Mat of key points = 79x1 (desktop)

Mat of key points = 216x1 (android)

Why is the difference? Are there any MSER default settings, which are different for desktop and android? I'm stuck here, any help much appreciated.

Regards

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by sturkmen
close date 2017-09-04 15:09:21.778538

Comments

I think you must change some parameters.

  1. first create a grayscale image without compression (like lena) and use this image on all platforms
  2. when use create for MSER use explicit params In c++ something like that :

    MSER::create(5,60,1440,0.25,,0.2,200,1.01,0.003,5); In java I don't know but use same parameters

After If you 've got still different results you can post your image and some users would be able to test it

LBerger gravatar imageLBerger ( 2015-08-22 06:23:14 -0600 )edit

Thanks a lot, I will try and let know the results. One question though - if I use exact same file for testing on android and desktop, wouldn't it matter if it has compression or not? I though imread() removes compression and colors or does it?

jcrist gravatar imagejcrist ( 2015-08-22 08:32:06 -0600 )edit

Yes I hope so. But with uncompressed image I'm sure that's a byte is read like a byte on all platform.

LBerger gravatar imageLBerger ( 2015-08-22 08:37:39 -0600 )edit

I found the problem - different versions of OpenCV on desktop and android. Version 3.0 is apparently using different default parameters than 3.0 RC1.

Thank you very much for prompt response and for help! Case closed

jcrist gravatar imagejcrist ( 2015-08-22 09:08:09 -0600 )edit