2016-11-14 14:47:08 UTC
I'm having some trouble using the IDL-Python bridge. I'm trying to run the face detection example from this blog post:
but my code is crashing at the point where it tries to detect the faces.
Here is the code:
cv2 = Python.Import('cv2')
imagePath = 'C:\temp\FaceDetect\abba.png'
cascPath = 'C:\temp\FaceDetect\haarcascade_frontalface_default.xml'
; Create the haar cascade
faceCascade = cv2.CascadeClassifier(cascPath)
; Read the image
image = cv2.imread(imagePath)
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
; Detect faces in the image
faces = faceCascade.detectMultiScale(gray,scaleFactor=1.1, $
flags = cv2.cv.CV_HAAR_SCALE_IMAGE)
The error I'm getting is:
% PYTHON_CALLMETHOD: Exception: Required argument 'rejectLevels' (pos 2) not found.
The code works fine when run from Python.
I think it's likely that there are multiple things going wrong with my code. One of them is that IDL is not recognizing that I'm calling the detectMultiScale method using another calling convention (there are two different ways of calling detectMultiScale, for some reason). See the docs here:
Next, the IDL-Python bridge is not recognizing the keywords correctly, since the keywords are case sensitive.
What else? I don't know.
Does anyone have a suggestion on how to make this work? I would really like to be able to do face detection within IDL.