OpenCV Python detectMultiscale
Hi guys can you give me advice about OpenCV? When I want to print out r to see rejectLevels it only print's out empty array.
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os, sys,
import logging, time
import numpy as np
import cv2
import cv2.cv as cv
face_cacade = '../home/haarcascade_frontalface_default.xml'
xml = cv2.CascadeClassifier(face_cascade)
array_of_images = [] --> Some images
for image in array_of_images:
img = cv2.imread(image)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
gray = cv2.equalizeHist(gray)
**r** = []
x = []
#cv2.CascadeClassifier.detectMultiScale(image, rejectLevels, levelWeights[, scaleFactor[, minNeighbors[, flags[, minSize[, maxSize[, outputRejectLevels]]]]]]) → objects
faces = xml.detectMultiScale(image = img, rejectLevels = **r**, levelWeights = x ,scaleFactor=1.05, minNeighbors=1, minSize=(30, 30), flags = cv.CV_HAAR_SCALE_IMAGE)
file_out = open('/tmp/faces_score.txt','w+',0)
for (x,y,w,h) in faces:
cv2.rectangle(img,(x,y),(x+w,y+h),(0,255,0),1)
roi_gray = gray[y:y+h, x:x+w]
roi_color = img[y:y+h, x:x+w]
print **r**, x
Can you give me some solution or experience on Opencv detectMultiScale, I looked into c++ code source and it's looking fine there, but in Python it wont work as it should be. OpenCV version: 2.4.8 Python version: 2.7.6
I think you are adressing it wrong. The rejectLevels is a parameter that can be passed as an input parameter looking at the documents. The only output parameter for the detectMultiScale function is objects parameter containing all detections. C++ don't use return variables, filling it up there. However I think the wrapper for python just ignores it for now... I think a bug report is maybe a good idea!
http://code.opencv.org/issues/2540
I knew I read about them somewhere!