[1] the output image when running opencv videocapture the output is always distorted. This is the code I used
import numpy as np
import cv2
cap = cv2.VideoCapture(0)
while(True):
# Capture frame-by-frame
ret, frame = cap.read()
# Our operations on the frame come here
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
# Display the resulting frame
cv2.imshow('frame',gray)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()
I had a similar issue on updating OpenCV. Downgrading to version 4.2.0.34 solved the problem for me. This isn't a permanent solution however, but I guess we'll have to wait until the issue is resolved.
This is what I did:
pip uninstall opencv-python
pip install opencv-python==4.2.0.34
The same code began to work after this change.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.