Python cv2, cant grab frame
up vote
-2
down vote
favorite
Im just starting to learn python. This is my first code. I tried using the webcam. For some reason it gives me an error.
Code
import cv2, time
video = cv2.VideoCapture(0)
check, frame = video.read()
print(check)
print(frame)
cv2.imshow("vegans have big gay", frame)
cv2.waitKey(0)
video.release()
errors:
False
[ WARN:0] videoio(MSMF): OnReadSample() is called with error status: -1072875772
None
[ WARN:0] videoio(MSMF): async ReadSample() call is failed with error status: -1072875772
[ WARN:1] videoio(MSMF): can't grab frame. Error: -1072875772
Traceback (most recent call last):
File "C:/Users/stasiek/PycharmProjects/pierwszy/capture.py", line 9, in <module>
cv2.imshow("vegans have big gay", frame)
cv2.error: OpenCV(3.4.3) C:projectsopencv-pythonopencvmoduleshighguisrcwindow.cpp:356: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow'
python frame webcam cv2
add a comment |
up vote
-2
down vote
favorite
Im just starting to learn python. This is my first code. I tried using the webcam. For some reason it gives me an error.
Code
import cv2, time
video = cv2.VideoCapture(0)
check, frame = video.read()
print(check)
print(frame)
cv2.imshow("vegans have big gay", frame)
cv2.waitKey(0)
video.release()
errors:
False
[ WARN:0] videoio(MSMF): OnReadSample() is called with error status: -1072875772
None
[ WARN:0] videoio(MSMF): async ReadSample() call is failed with error status: -1072875772
[ WARN:1] videoio(MSMF): can't grab frame. Error: -1072875772
Traceback (most recent call last):
File "C:/Users/stasiek/PycharmProjects/pierwszy/capture.py", line 9, in <module>
cv2.imshow("vegans have big gay", frame)
cv2.error: OpenCV(3.4.3) C:projectsopencv-pythonopencvmoduleshighguisrcwindow.cpp:356: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow'
python frame webcam cv2
add a comment |
up vote
-2
down vote
favorite
up vote
-2
down vote
favorite
Im just starting to learn python. This is my first code. I tried using the webcam. For some reason it gives me an error.
Code
import cv2, time
video = cv2.VideoCapture(0)
check, frame = video.read()
print(check)
print(frame)
cv2.imshow("vegans have big gay", frame)
cv2.waitKey(0)
video.release()
errors:
False
[ WARN:0] videoio(MSMF): OnReadSample() is called with error status: -1072875772
None
[ WARN:0] videoio(MSMF): async ReadSample() call is failed with error status: -1072875772
[ WARN:1] videoio(MSMF): can't grab frame. Error: -1072875772
Traceback (most recent call last):
File "C:/Users/stasiek/PycharmProjects/pierwszy/capture.py", line 9, in <module>
cv2.imshow("vegans have big gay", frame)
cv2.error: OpenCV(3.4.3) C:projectsopencv-pythonopencvmoduleshighguisrcwindow.cpp:356: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow'
python frame webcam cv2
Im just starting to learn python. This is my first code. I tried using the webcam. For some reason it gives me an error.
Code
import cv2, time
video = cv2.VideoCapture(0)
check, frame = video.read()
print(check)
print(frame)
cv2.imshow("vegans have big gay", frame)
cv2.waitKey(0)
video.release()
errors:
False
[ WARN:0] videoio(MSMF): OnReadSample() is called with error status: -1072875772
None
[ WARN:0] videoio(MSMF): async ReadSample() call is failed with error status: -1072875772
[ WARN:1] videoio(MSMF): can't grab frame. Error: -1072875772
Traceback (most recent call last):
File "C:/Users/stasiek/PycharmProjects/pierwszy/capture.py", line 9, in <module>
cv2.imshow("vegans have big gay", frame)
cv2.error: OpenCV(3.4.3) C:projectsopencv-pythonopencvmoduleshighguisrcwindow.cpp:356: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow'
python frame webcam cv2
python frame webcam cv2
asked Nov 10 at 12:45
stanisław słowiński
15
15
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Try this way, resizing the video and wrapping video capture in a loop (with break on key pressed):
import cv2
video = cv2.VideoCapture(0)
video.set(cv2.CAP_PROP_FRAME_WIDTH,640);
video.set(cv2.CAP_PROP_FRAME_HEIGHT,480);
while True:
check, frame = video.read()
cv2.imshow('Video window', frame)
# press 'q' on keyboard to exit
if cv2.waitKey(1) & 0xFF == ord('q'):
break
video.release()
cv2.destroyAllWindows()
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Try this way, resizing the video and wrapping video capture in a loop (with break on key pressed):
import cv2
video = cv2.VideoCapture(0)
video.set(cv2.CAP_PROP_FRAME_WIDTH,640);
video.set(cv2.CAP_PROP_FRAME_HEIGHT,480);
while True:
check, frame = video.read()
cv2.imshow('Video window', frame)
# press 'q' on keyboard to exit
if cv2.waitKey(1) & 0xFF == ord('q'):
break
video.release()
cv2.destroyAllWindows()
add a comment |
up vote
0
down vote
Try this way, resizing the video and wrapping video capture in a loop (with break on key pressed):
import cv2
video = cv2.VideoCapture(0)
video.set(cv2.CAP_PROP_FRAME_WIDTH,640);
video.set(cv2.CAP_PROP_FRAME_HEIGHT,480);
while True:
check, frame = video.read()
cv2.imshow('Video window', frame)
# press 'q' on keyboard to exit
if cv2.waitKey(1) & 0xFF == ord('q'):
break
video.release()
cv2.destroyAllWindows()
add a comment |
up vote
0
down vote
up vote
0
down vote
Try this way, resizing the video and wrapping video capture in a loop (with break on key pressed):
import cv2
video = cv2.VideoCapture(0)
video.set(cv2.CAP_PROP_FRAME_WIDTH,640);
video.set(cv2.CAP_PROP_FRAME_HEIGHT,480);
while True:
check, frame = video.read()
cv2.imshow('Video window', frame)
# press 'q' on keyboard to exit
if cv2.waitKey(1) & 0xFF == ord('q'):
break
video.release()
cv2.destroyAllWindows()
Try this way, resizing the video and wrapping video capture in a loop (with break on key pressed):
import cv2
video = cv2.VideoCapture(0)
video.set(cv2.CAP_PROP_FRAME_WIDTH,640);
video.set(cv2.CAP_PROP_FRAME_HEIGHT,480);
while True:
check, frame = video.read()
cv2.imshow('Video window', frame)
# press 'q' on keyboard to exit
if cv2.waitKey(1) & 0xFF == ord('q'):
break
video.release()
cv2.destroyAllWindows()
answered Nov 10 at 14:47
iGian
2,2832620
2,2832620
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53239091%2fpython-cv2-cant-grab-frame%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown