Professional Documents
Culture Documents
watch_cascade = cv2.CascadeClassifier('cascade.xml')
image = cv2.imread("car.jpg")
x -= w * 0.14
w += w * 0.28
y -= h * 0.15
h += h * 0.3
def cropImage(image,rect):
cv2.imshow("imageShow", image)
cv2.waitKey(0)
x, y, w, h = computeSafeRegion(image.shape,rect)
cv2.imshow("imageShow", image[y:y+h,x:x+w])
cv2.waitKey(0)
return image[y:y+h,x:x+w]
def computeSafeRegion(shape,bounding_rect):
top = bounding_rect[1] # y
bottom = bounding_rect[1] + bounding_rect[3] # y + h
left = bounding_rect[0] # x
right = bounding_rect[0] + bounding_rect[2] # x + w
min_top = 0
max_bottom = shape[0]
min_left = 0
max_right = shape[1]
#print(left,top,right,bottom)
#print(max_bottom,max_right)
images = detectPlateRough(image,image.shape[0],top_bottom_padding_rate=0.1)