Reputation: 1
I am using opencv-python 4.9.0 python 3.9 windows 10
I am trying to use HTC VIVE VR (disable direct mode) to run some experiments and everything worked fine before, but suddenly showed the following error a couple of weeks ago:
[ WARN:[email protected]] global cap_msmf.cpp:1768 CvCapture_MSMF::grabFrame videoio(MSMF): can't grab frame. Error: -2147483638
The same code and hardware still work on my personal PC, same Error can be replicated after I fail to take a camera photo (using the default Windows app). Deleted camera driver from device manager replugged it can fix it.
Here is the code I used for testing:
import cv2
cap = cv2.VideoCapture(0) #cv2.CAP_DSHOW
# cap.set(cv2.CAP_PROP_FRAME_WIDTH, 612)
# cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 460)
# cap.set(cv2.CAP_PROP_FPS, 30)
while True:
ret, img = cap.read()
cv2.imshow("video", img)
key = cv2.waitKey(1)
if key == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
The camera can be displayed when it just plugged in before I run any code: 1
after I ran the code the preview turned grey
Here is a list of things I tried:
Change USB port(worked previously)
Chang USB wire
Change VR headset device
Enable/disable camera in steam VR
Enable camera access in Privacy
Disconnect all USB
Restart headset
Reinstall steam VR
Reinstall steam
Reinstall OpenCV
reinstall anaconda
reset windows
upgrade to windows 11 (same as my personal PC)
change variable OPENCV_VIDEOIO_PRIORITY_MSMF to 0 (this can show a frame, but it's all black with some coloured pixels, same with using cv2.VideoCapture(0,cv2.CAP_DSHOW)
(https://i.sstatic.net/mceg5.png)
Upvotes: 0
Views: 67