Ask Your Question

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

asked 2018-02-28 04:05:33 -0500

Joshitha gravatar image

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 ?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2018-02-28 04:15:46 -0500

berak gravatar image

no, you can't it's an entirely different model.

(and unfortunately, as of now, you cannot use the dpm classes from opencv_contrib from python)

edit flag offensive delete link more


Oh! can you please link me to a source code of some sort that uses this class in C++ / C? I found a pretrained cow.xml file that I thought I could use as u had suggested

Joshitha gravatar imageJoshitha ( 2018-02-28 05:40:05 -0500 )edit

oh, ofc., sorry:

and careful, you probably have to use xml files from here (there was a previous version in 2.x, that used a different format !)

berak gravatar imageberak ( 2018-02-28 06:00:45 -0500 )edit

Question Tools

1 follower


Asked: 2018-02-28 04:05:33 -0500

Seen: 666 times

Last updated: Feb 28 '18