Getting error when drawing polylines using python and opencv -


i getting error:

file "c:/python27/drawinginthevideo.py", line 22, in cv2.imshow('frame 2', frame2) cv2.error: ........\opencv\modules\highgui\src\window.cpp:261: error: (-215) size.width>0 && size.height>0 in function cv::imshow

and using code:

import numpy np import cv2  cap = cv2.videocapture('vid2.mp4')  # open video file  while (cap.isopened()):     ret, frame = cap.read()  # read frame     try:         cv2.imshow('frame', frame)         frame2 = frame     except:         # if there no more frames show...         print('eof')         break      line1 = np.array([[100, 100], [300, 100], [350, 200]], np.int32).reshape((-1, 1, 2))     line2 = np.array([[400, 50], [450, 300]], np.int32).reshape((-1, 1, 2))      frame2 = cv2.polylines(frame2, [line1], false, (255, 0, 0), thickness=2)     frame2 = cv2.polylines(frame2, [line2], false, (0, 0, 255), thickness=1)      cv2.imshow('frame 2', frame2)      # abort , exit 'q' or esc     k = cv2.waitkey(30) & 0xff     if k == 27:         break  cap.release()  # release video file cv2.destroyallwindows()  # close opencv windows 

what doing wrong? please help


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -