Parameters of detectMultiScale in OpenCV using Python

vss picture vss · Mar 25, 2016 · Viewed 46.2k times · Source

I am not able to understand the parameters passed to detectMultiScale. I know that the general syntax is detectMultiScale(image, rejectLevels, levelWeights) However, what do the parameters rejectLevels and levelWeights mean? And what are the optimal values used for detecting objects?

I want to use this to detect pupil of the eye

Answer

tfv picture tfv · Mar 26, 2016

A code example can be found here: http://docs.opencv.org/3.1.0/d7/d8b/tutorial_py_face_detection.html#gsc.tab=0

Regarding the parameter descriptions, you may have quoted old parameter definitions, in fact you may be faced with the following parameters:

  • scaleFactor: Parameter specifying how much the image size is reduced at each image scale.
  • minNeighbors: Parameter specifying how many neighbors each candidate rectangle should have to retain it

Here you can find a nice explanation on these parameters: http://www.bogotobogo.com/python/OpenCV_Python/python_opencv3_Image_Object_Detection_Face_Detection_Haar_Cascade_Classifiers.php

Make sure to obtain proper pretrained classifier sets for faces and eyes such as

  • haarcascade_frontalface_default.xml
  • haarcascade_eye.xml