Ask Your Question
0

Opencv 3 - python detectmultiscale; too many values to upack

asked 2015-07-02 11:09:26 -0500

I'm trying to get access to either numDetections or rejectLevels and levelWeights so that I can judge confidence levels for each object detected by the cascade classifier. When I try:

faces, num_detections = faceCascade.detectMultiScale(
     gray,
     scale_factor = 3,
     minNeighbors = 3,
     minSize = (30, 30)
)

I get the error "too many values to unpack"

when I try

faces, reject_levesl, level_weights = faceCascade.detectMultiScale(
         gray,
         scale_factor = 3,
         minNeighbors = 3,
         minSize = (30, 30),
         outputRejectLevels = True
 )

I get the error outputRejectLevels is an invalid keyword argument for this function. Am I doing something horribly wrong? I'm running the current beta version of Opencv 3 and am on Arch linux. When I try and run the classifier normally it works like a charm. Any help greatly appreciated!

edit retag flag offensive close merge delete

Comments

looking at

detectMultiScale(...)
    detectMultiScale(image[, scaleFactor[, minNeighbors[, flags[, minSize[, maxSize]]]]]) -> objects

it seems like you're just getting faces (and nothing else) back, and there's no outputRejectLevels argument.

joe minichino gravatar imagejoe minichino ( 2015-07-03 04:03:25 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-12-06 21:46:51 -0500

jpwp gravatar image

At least on OpenCV 3.0 you can use something like:

faces = faceCascade.detectMultiScale3(
    gray,
    scaleFactor=1.1,
    minNeighbors=5,
    minSize=(30, 30),
    flags = cv2.CASCADE_SCALE_IMAGE,
    outputRejectLevels = True
)

rects = faces[0]
something = faces[1]
weights = faces[2]
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2015-07-02 11:08:25 -0500

Seen: 758 times

Last updated: Jul 02 '15