riscritto per VLC

This commit is contained in:
Gianluca Romito
2021-03-08 16:19:11 +01:00
parent 55ec77508b
commit 1b2a690367
4 changed files with 72 additions and 46 deletions

44
appold.py Normal file
View File

@@ -0,0 +1,44 @@
import os
import cv2
from flask import Flask, request, Response
import win32gui
import win32con
finestra = 0 # per capire se la finestra è gia aperta...
# http://webcam-garage.romito.net/videostream.cgi
# http://admin:admin@192.168.123.1/cgi-bin/videostream.cgi?user=admin&pwd=admin
# per l'always on top https://efotinis.neocities.org/deskpins/
def openwebcam():
global cap
global finestra
if finestra == 0:
finestra = 1
#cap = cv2.VideoCapture('http://xxx:yyy@indirizzocam/videostream.cgi')
#cap = cv2.VideoCapture('http://admin:admin@192.168.123.199')
cap = cv2.VideoCapture('rtsp://admin:admin@192.168.123.199/0')
WindowName="Telecamera"
ret, frame = cap.read()
frame = cv2.resize(frame, (224, 224))
cv2.imshow(WindowName,frame)
text_color = (255,255,255)
while True:
ret, frame = cap.read()
frame = cv2.resize(frame, (int(1920/3), int(1080/3))) # ridimensiona l'immagine, commentare per default
cv2.putText(frame, "Premi q per uscire", (20,15), cv2.FONT_HERSHEY_PLAIN, 1.0, text_color, thickness=2)
cv2.imshow(WindowName,frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
finestra = 0
app = Flask(__name__)
@app.route('/webhook', methods=['GET'])
def respond():
openwebcam()