0

I am developing an android text recognition app in java with Opencv 4.0.1 and tests-two(tesseract). I am doing with downloaded source code. they have used OpenCV version 3.2.0 But the Issue is when I was trying to import FeatureDetector for MSER unable to import that but they did it on version 3.2.0

My Android Studio version is 4.0.1

Is there any alternative way?? How can I replace

Here is the code

  FeatureDetector detector = FeatureDetector.create(FeatureDetector.MSER);
            detector.detect(mGray, keyPoint);  

this is the import I could not call

import org.opencv.features2d.FeatureDetector;
Community
  • 1
  • 1
Nusry KR
  • 105
  • 1
  • 3
  • 13

2 Answers2

1

This link says it is deprecated and suggests to directly instantiate Feature2D classes.

https://docs.opencv.org/3.4/javadoc/org/opencv/features2d/FeatureDetector.html

In this link below there is no FeatureDetector in features2d package for 4.0.1. It has a FastFeatureDetector class in this package.

https://docs.opencv.org/4.0.1/javadoc/org/opencv/features2d/package-summary.html https://docs.opencv.org/4.0.1/javadoc/org/opencv/features2d/FastFeatureDetector.html

You can try import with, org.opencv.features2d.MSER and follow something like this. Another option is to downgrade.

https://docs.opencv.org/4.0.1/javadoc/org/opencv/features2d/MSER.html

B200011011
  • 3,798
  • 22
  • 33
  • if I downgrade, will there is any problems occur? It mean I am doing with latest Android studion version – Nusry KR Nov 11 '20 at 12:40
  • 1
    You should first try without downgrading. In case of downgrade, if your app requires additions from newer opencv versions then you may face problems. Android studio version is not directly related with this. – B200011011 Nov 11 '20 at 13:11
0

The hint in the docs "Please use direct instantiation of Feature2D classes" is not very helpful IMO.

But I think I found the answer. FWIW, here's the code I am working with:

FeatureDetector detector = FeatureDetector.create(FeatureDetector.SIMPLEBLOB);

I think this is the new way to do the same:

SimpleBlobDetector detector = SimpleBlobDetector.create();

And I think this is what you're looking for:

MSER detector = MSER.create();
detector.detect(mGrey, keyPoint);

FWIW I don't know why simple blob is named as a detector and MSER is not. I don't know much about these classes. I'm trying to upgrade code that someone else wrote.

steve
  • 1,021
  • 1
  • 14
  • 29