Hello.
I want to use MSER to detect text. Something along these lines.
So I wrote this function:
private void detectRegions() {
int delta = 5;
int min_area = 60;
int max_area = 14400;
double max_variation = 0.25;
double min_diversity = .2;
int max_evolution = 200;
double area_threshold = 1.01;
double min_margin = .003;
int edge_blur_size = 5;
MSER mser = MSER.create(delta, min_area, max_area, max_variation, min_diversity, max_evolution, area_threshold, min_margin, edge_blur_size);
int imgsize = mGrey.height() * mGrey.width();
List<MatOfPoint> msers = new ArrayList<MatOfPoint>();
MatOfRect bboxes = new MatOfRect();
mser.detectRegions(mGrey, msers, bboxes);
writeToTextView(Integer.toString(msers.size()));
OCR(msers);
}
But I get complete garbage. Lots of totally absurd text.
So I'm wondering what I'm doing wrong?
I found this example on Github.
Maybe I need to use these two functions somehow:
Imgproc.morphologyEx(mask, morbyte, Imgproc.MORPH_DILATE, kernel);
Imgproc.findContours(morbyte, contour2, hierarchy,
Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_NONE);
Also, what is all that Rectangle manipulations doing? Also, how does that feed into the two functions above?
Thanks