Ask Your Question
0

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

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

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:

cv2.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2)

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

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

cv2.imshow('img',img)

cv2.waitKey(0)

cv2.destroyAllWindows()

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
3

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

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

Comments

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 -0600 )edit

oh, ofc., sorry:

https://github.com/opencv/opencv_cont...

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 -0600 )edit

Question Tools

1 follower

Stats

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

Seen: 1,146 times

Last updated: Feb 28 '18