I build a web application and want to use PHP to exec the Python script on the Raspberry Pi. It works, but when I try to open some Python script which includes the OpenCV, nothing happens and there is no error message. I try to run this PHP in the terminal, it works fine, so I don't know what happens?
# -*- coding: utf-8 -*-
import cv2
cap = cv2.VideoCapture(0)
print("VideoCapture is opened?", cap.isOpened())
while(True):
ret, frame = cap.read()
center = (frame.shape[1]//2, frame.shape[0]//2)
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.circle(gray, center=center, radius=100, color=(0,0,255))
cv2.imshow("frame", gray)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()