(im new to both machine learning and python so i wanted to see if i can do a project from github to learn while doing it) there were a lot of errors i got that i was able to fix by myself with the help of stackoverflow but im unable to fix this one so i hope someone can help me with this

global cap1     
cap1 = WebcamVideoStream(src=0).start() 
frame1 = cap1.read()
frame1 = cv2.resize(frame1,(600,500)) 

it says "OpenCV(4.1.2) /io/opencv/modules/imgproc/src/resize.cpp:3720: error: (-215:Assertion failed) !ssize.empty() in function 'resize' "

i tried doing this

frame1 = cv2.resize(frame1,(600,500),fx=0,fy=0, interpolation = cv2.INTER_CUBIC)

but it still shows the same error

this is the code for WebcamVideoStream class :

    class WebcamVideoStream:
    
    def __init__(self, src=0):
        self.stream = cv2.VideoCapture(src,cv2.CAP_DSHOW)
        (self.grabbed, self.frame) = self.stream.read()
        self.stopped = False

    def start(self):
            # start the thread to read frames from the video stream
        Thread(target=self.update, args=()).start()
        return self
        
    def update(self):
        # keep looping infinitely until the thread is stopped
        while True:
            # if the thread indicator variable is set, stop the thread
            if self.stopped:
                return
            # otherwise, read the next frame from the stream
            (self.grabbed, self.frame) = self.stream.read()

    def read(self):
        # return the frame most recently read
        return self.frame
    def stop(self):
        # indicate that the thread should be stopped
        self.stopped = True
0

There are 0 best solutions below