Ask Your Question

createERFilterNM1 - Parameter

asked 2015-10-25 05:16:17 -0600

RHX gravatar image

updated 2015-10-27 13:21:54 -0600

I'm using the Scene Text Detection features of OpenCV and have some troubles finding the optimal parameters for createERFilterNM1. Here is what the doc states:

C++: Ptr<erfilter> createERFilterNM1(const Ptr<erfilter::callback>& cb, int thresholdDelta=1, float minArea=0.00025, float maxArea=0.13, float minProbability=0.4, bool nonMaxSuppression=true, float minProbabilityDiff=0.1 ) Parameters:

  • cb – Callback with the classifier. Default classifier can be implicitly load with function loadClassifierNM1(), e.g. from file in samples/cpp/trained_classifierNM1.xml
  • thresholdDelta – Threshold step in subsequent thresholds when extracting the component tree
  • minArea – The minimum area (% of image size) allowed for retreived ER’s
  • maxArea – The maximum area (% of image size) allowed for retreived ER’s
  • minProbability – The minimum probability P(er|character) allowed for retreived ER’s
  • nonMaxSuppression – Whenever non-maximum suppression is done over the branch probabilities
  • minProbabilityDiff – The minimum probability difference between local maxima and local minima ERs

The default values are not the same as in the example. So I wonder what the optimal settings are.

Would it be possible to optimize the settings when I know the fontsize of the to-detect-text? Maybe by setting the max/minArea to the size of a letter? Keeping this in mind I tried to tweak the settings a bit to get text detection for this image to work (I would like to detect the subtitles). With thresholdDelta = 16, minArea = 0.0004 maxArea = 0.04 I get these results. Changing minProbability and minProbabilityDiff seems to change nothing. But maybe it's no use given the quality of the source image.

I lack the clear understanding of the parameters. Could someone please explain the parameters more in detail for me or give some hints on how to find the optimal parameters?

EDIT After reading the doc more carefully I think I understand everything. Ill try to optimize the parameter for a given text size and post again. This may take some time though.

edit retag flag offensive close merge delete


Hello @RHX! I am trying to detect text in some images (comic pages) using Scene Text Detection. I have been tweaking the parameters for the ERFilterNM1 function, also trying to "clean" the image beforehand but I do not achieve very good results.. I wonder if you got any further with this? Thank you!

vbaro gravatar imagevbaro ( 2017-12-10 00:33:30 -0600 )edit

1 answer

Sort by » oldest newest most voted

answered 2017-06-11 12:01:27 -0600

jbeale gravatar image

Thanks for posting this comment. I had the same experience. The example using thresholdDelta = 16 does not work very well, unless you have already cropped out just a small region of interest. If you make that value much smaller, for example thresholdDelta = 4 then the algorithm can find many more text regions, with only slightly more runtime.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-10-25 05:16:17 -0600

Seen: 1,297 times

Last updated: Jun 11 '17