primo commit

This commit is contained in:
Gianluca Romito
2021-02-24 08:15:59 +01:00
commit e2d00b9eb9
5 changed files with 117 additions and 0 deletions

58
.gitignore vendored Normal file
View File

@@ -0,0 +1,58 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# OSX useful to ignore
*.DS_Store
.AppleDouble
.LSOverride
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
# IntelliJ Idea family of suites
.idea
*.iml
## File-based project format:
*.ipr
*.iws
## mpeltonen/sbt-idea plugin
.idea_modules/

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

17
README.md Normal file
View File

@@ -0,0 +1,17 @@
Wwebhook per telecamera. Progetto fatto per Angelo.
in pratica tramite ESP8266 (easyesp) se uno preme un bottone, sul PC esce in primo piano una finestra che mostra una IP cam.
Il sito con lo schema
https://community.blynk.cc/t/problem-using-physical-4-buttons-using-nodemcu-esp8266-to-switch-relays/36361/3
La schermata non sempre viene in primo piano. Per questo usare https://efotinis.neocities.org/deskpins/
Sembra che opencv non gestisca correttamente questa cosa (fatto varie prove)
Rule su ESP:
----------------------
On Bottone#State=1 do
SendToHTTP 192.168.123.102,5000,/webhook
endon
----------------------
per la config di "bottone" vedi png.

42
app.py Normal file
View File

@@ -0,0 +1,42 @@
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/
#print("Before URL")
def openwebcam():
global finestra
if finestra == 0:
finestra = 1
cap = cv2.VideoCapture('http://admin:smart24@webcam-garage.romito.net/videostream.cgi')
WindowName="Main View"
ret, frame = cap.read()
cv2.imshow(WindowName,frame)
text_color = (0,0,0)
while True:
ret, frame = cap.read()
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()

BIN
button setup.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB