0

i'm trying to capture the video stream using piCam. but i get this warning and the execution stops enter image description here

this the code:

this the code I used:

import numpy as np
import cv2
cap = cv2.VideoCapture(0)
cap.set(3,640) 
cap.set(4,480) 
while(True):
    ret, frame = cap.read()
    cv2.imshow('frame', frame)
    k = cv2.waitKey(30) & 0xff
    if k == 27: # press 'ESC' to quit
        break
cap.release()
cv2.destroyAllWindows()
  • Is $DISPLAY set? – RalfFriedl May 17 at 23:29
  • oh, no.. it returns a blank line.. well.. could you tell me please how to set it? – Ura May 18 at 1:17
  • Do you have a GUI running? Usually, when you open a terminal window from the GUI, $DISPLAY is set to the correct value. – RalfFriedl May 18 at 6:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.