Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to use a dpm cascade model xml file in a Python script?

I was wondering if I can use the same code used to run a Haar Cascade xml file , to run the dpm cascade model xml file.

My code looks like this :

import numpy as np

import cv2

cow_cascade = cv2.CascadeClassifier('cow.xml')

img = cv2.imread('Cow3.bmp')

gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

cows = cow_cascade.detectMultiScale(gray, 1.3, 5)

for (x,y,w,h) in cows:


roi_gray = gray[y:y+h, x:x+w]

roi_color = img[y:y+h, x:x+w]




What are the modifications to be made to use a dpm cascade model xml file ?