car detector in image

''''
for the xml file
.................................................................................................................................
''''

import cv2
img_file = '3058.jpg'
classifier_file ='car_detector.xml'
img = cv2.imread(img_file)

bw = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
car_tracker = cv2.CascadeClassifier(classifier_file)

cars  = car_tracker.detectMultiScale(bw)

for (x,y,w,h) in cars:
    cv2.rectangle(img, (x,y),(x+w,y+h), (0,0,255),2)

cv2.imshow('car detector machine', img)
cv2.waitKey()
print ("code completed")




hears the screanshot.

Comments

Post a Comment

Popular posts from this blog

environment creation on python

scatterplot/ violon plot /histogram /boxplot

Pcb Fault Detection(Deep Learning Technique)