The above error still persists even after upgrading my opencv library and also uninstalling and reinstalling several times.
Any other tips to fix this error?
This my source code, the cv2.imshow() function started giving me the error.
cap = cv2.VideoCapture(0)
while True:
_, frame = cap.read()
sobelx = cv2.Sobel(frame, cv2.CV_64F, 1, 0, ksize=5)
sobely = cv2.Sobel(frame, cv2.CV_64F, 0, 1, ksize=5)
cv2.imshow('frame', frame)
cv2.imshow('sobelx', sobelx)
cv2.imshow('sobely', sobely)
if cv2.waitKey(5) & 0xFF == 27:
break
cv2.destroyAllWindows()
cap.release()
The Error Message I recieve:
cv2.imshow('sobelx', sobelx)
cv2.error: OpenCV(4.0.0) C:\projects\
opencv-python\opencv\modules\highgui\src\window_w32.cpp:1230:
error: (-215:Assertion failed) dst.data == (uchar*)dst_ptr in function 'cvShowImage'
On the other hand the cv2.imshow() function works properly for the below code. Please note: The code below does not apply any filters like laplacian or sobel to the video feed.
cap = cv2.VideoCapture(0)
while True:
_, frame = cap.read()
cv2.imshow('frame', frame)
if cv2.waitKey(5) & 0xFF == 27:
break
cv2.destroyAllWindows()
cap.release()