Reputation: 41
I am building a generic text parsing algorithm for images. I was running:
MSER.detectRegions()
vs
findContours(...cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
on a binary image. The results where the same. I know MSER can be done on gray-scale but I wanted to go safer.
I need to select one of them and the findContours()
takes less then half the run time MSER
does.
Am I missing something? What would you pick?
Upvotes: 3
Views: 4658
Reputation: 2179
As already pointed out, it does not make sense to compute MSER on a binary image. MSER basically thresholds an image (grayscale) multiple times using increasing (decreasing) thresholds and what you get is a so called component tree like this here. The connected components which change their size/shape at least over the different binarizations are the so-calles Maximally Stable Extremal Regions (e.g. the K in the schematic graphic). This is of course a very simplified explanation. Please ask Google for more details, you'll find enough.
As you can see, thresholding an already thresholded image does not make sense. So pass the grayscale image to the MSER algorithm instead. MSER is a common basis for state-of-the-art text detection approaches (see here and here).
Upvotes: 4