Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 2088

How to solve TypeError: Expected Ptr for argument 'src'?

$
0
0
I'm trying to highlight faces in a video with face_cascade. My code: import cv2 face_cascade = cv2.CascadeClassifier('D:/Anaconda/Lib/site-packages/cv2/data/haarcascade_frontalface_default.xml') frame2 = cv2.VideoCapture('C:/Users/HomePC/Desktop/video.mp4') scaling_factor = 0.5 frame2 = cv2.resize(frame2, None, fx=scaling_factor, fy = scaling_factor, interpolation = cv2.INTER_AREA) face_rects2 = face_cascade.detectMultiScale(frame2, scaleFactor = 1.3, minNeighbors = 6) for (x,y,w,h) in face_rects1: cv2.rectangle(frame2, (x,y), (x+w,y+h), (0,255,0), 3) cv2.imshow('Input video', frame2) print('Found {0} faces in Input video!'.format(len(face_rects2))) And here is the error I get: runfile('C:/Users/HomePC/Desktop/ArtInt/3lab/lab3.py', wdir='C:/Users/HomePC/Desktop/ArtInt/3lab') Found 3 faces in Input image #2! Traceback (most recent call last): File "C:\Users\HomePC\Desktop\ArtInt\3lab\lab3.py", line 29, in frame2 = cv2.resize(frame2, None, fx=scaling_factor, fy = scaling_factor, interpolation = cv2.INTER_AREA) TypeError: Expected Ptr for argument 'src'

Viewing all articles
Browse latest Browse all 2088

Trending Articles