VIDEOIO ERROR: V4L: can't open camera by index 0
Hello,
I'm triggering a Python file with PHP.
$return = shell_exec("/usr/bin/python3.6 create.py 2>&1")
Python File
import numpy as np
import cv2
cap = cv2.VideoCapture(0)
while(True):
ret, frame = cap.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow('frame',gray)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
Return this value
VIDEOIO ERROR: V4L: can't open camera by index 0
What is the problem?
are you sure, it HAS a camera plugged in ?
try with -1 as index.
Type following command on terminal to check list of video devices connected to your system. ls ~/../../dev/video* If video0 is not present then replug your camera.
@berak i tried this `cv2.VideoCapture(-1)
@ak1 file exists. Listed.
When you run the Python file, the camera turns on. However, it does't work when triggered by PHP.
oh, can it be that php does not have user rights to do that ?
It doesn't give anything like 'permission error'. When I changed the permissions I got 'permission error'. I don't think it's a permission error.