Object detection and scale

hello ,we have detection project for the non human vehicle with camera , ı bought ur object detection course but ıts not positive for me , cause ı wanna learn the scale wtih the detect any object for example when we see the object ın the ımage , i wanna detect and see the line with object JUST LIKE THIS IMAGE UNDER THE PAGE. Can u help me for thıs job cause ı need help , we have project now but we cant do code , pls help me for the code . Thx brother…**

import cv2

Source data

img_file = “iha.png”

create an openCV image

img = cv2.imread(img_file,0)

pre trained Car and Pedestrian classifiers

car_classifier = ‘Ucak3.xml’

create trackers using classifiers using OpenCV

car_tracker = cv2.CascadeClassifier(car_classifier)

detect cars

cars = car_tracker.detectMultiScale(img)

display the coordinates of different cars - multi dimensional array


draw rectangle around the cars

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

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

cv2.putText(img, 'Car', (x, y - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.7, (0, 255, 0), 2)

Finally display the image with the markings

cv2.imshow(‘my detection’,img)

wait for the keystroke to exit


print(“I’m done”)

this is my code but ıts not workıng good , help me for the another good codes