não estou conseguindo abri o vídeo dentro do meu código para detecçaõ de veículos. é um trabalho da matéria de POO
 
	Gostaria de ajuda, sou iniciante. Segue o código abaixo
 
	import cv2 
	import numpy as np 
	class Deteccao_Do_Objeto: 
	def __init__(self,video): 
	self.largura_minima_do_contorno = 50 
	self.altura_minima_do_contorno = 50 
	self.largura_da_tela= 1920 
	self.altura_da_tela= 1080 
	self.desvio = 1.7 
	self.altura_da_linha = 500 
	self.partidas = [] 
	self.carros = 0 
	self.video = video 
	self.cap = cv2.VideoCapture(video) 
	self.cap.set(3, self.largura_da_tela) 
	self.cap.set(4, self.altura_da_tela) 
	 
	 
	def get_centrolide(self,x, y, largura,altura): 
	x1 = int(largura / 2) 
	y1 = int(altura / 2) 
	centroid_x = x + x1 
	centroid_y = y + y1 
	return centroid_x, centroid_y 
	 
	def VerificarCarro(self, ,): 
	global frame2 
	if self.cap.isOpened(): 
	self.partidas 
	ret, frame1 = self.cap.read() 
	ret, frame2 = self.cap.read() 
	else: 
	ret = False 
	ret, frame1 = self.cap.read() 
	ret, frame2 = self.cap.read() 
	 
	while ret: 
	diff = cv2.absdiff(frame1, frame2) 
	grey = cv2.cvtColor(diff, cv2.COLOR_BGR2GRAY) 
	kernel_size = (5,5) 
	variation_Gaussian_function = 0 
	blur = cv2.GaussianBlur(grey, kernel_size, variation_Gaussian_function) 
	limit_to_white = 20 
	ret, th = cv2.threshold(blur, limit_to_white, 255, cv2.THRESH_BINARY) 
	dilated = cv2.dilate(th, np.ones((3, 3))) 
	kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (2, 2)) 
	closing = cv2.morphologyEx(dilated, cv2.MORPH_CLOSE, kernel) 
	contours, height = cv2.findContours(closing, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) 
	 
	 
	for (i, contour) in enumerate(contours): 
	(x, y, largura, altura) = cv2.boundingRect(contour) 
	contour_valid = (largura >= self.largura_minima_do_contorno) and (altura >= self.altura_minima_do_contorno) 
	if not contour_valid: 
	continue 
	cv2.rectangle(frame1, (x - 10, y - 10), (x + largura + 10, y + altura + 10), (255, 0, 0), 2) 
	color_frame = (0, 255, 0) 
	cv2.line(frame1, (0, self.altura_da_linha), (2600, self.largura_da_linha), color_frame, 2) 
	centrolid = self.get_centrolid(x, y, largura, altura) 
	self.partidas.append(centrolid) 
	circle_color = (0, 255, 0) 
	circle_radius = 5 
	fill_circle = -1 
	cv2.circle(frame1, centrolid, circle_radius, circle_color, fill_circle) 
	cx, cy = get_centrolid(x, y, largura,altura) 
	 
	 
	for (x, y) in self.partidas: 
	if y < (line_height + self.desvio) and y > (line_height - self.desvio): 
	self.carros = self.carros + 1 
	self.partidas.remove((x, y)) 
	 
	 
	cv2.putText(frame1, "Total Cars Detected: " + str(self.carros), (20, 120), cv2.FONT_HERSHEY_SIMPLEX, 3, 
	(0, 0, 255), 5) 
	cv2.namedWindow("Vehicle Detection", cv2.WINDOW_NORMAL) 
	cv2.setWindowProperty("Vehicle Detection", cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_FULLSCREEN) 
	cv2.imshow("Vehicle Detection", frame1) 
	 
	if cv2.waitKey(1) == 27: 
	break 
	frame1 = frame2 
	ret, frame2 = self.cap.read() 
	 
	 
	 
	 
	visualizar = Deteccao_Do_Objeto('Videocarro.mp4') 
	visualizar.VerificarCarro()