Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions RPi/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
from flask import Flask, render_template, Response, send_from_directory
from flask_cors import *
# import camera driver
import camera_opencv
# from camera_opencv import Camera
# from camera_opencv import commandAct
#import camera_opencv
from camera_opencv import Camera
from camera_opencv import commandAct
import threading

# Raspberry Pi camera module (requires picamera package)
# from camera_pi import Camera

app = Flask(__name__)
CORS(app, supports_credentials=True)
camera = camera_opencv.Camera()
camera = Camera()

def gen(camera):
"""Video streaming generator function."""
Expand Down Expand Up @@ -64,11 +64,11 @@ def __init__(self):
self.camera = camera

def commandInput(self, inputCommand, valueA=None):
camera_opencv.commandAct(inputCommand, valueA)
commandAct(inputCommand, valueA)

def modeselect(self, modeInput):
camera_opencv.Camera.modeSelect = modeInput
camera_opencv.Camera.CVMode = 'no'
Camera.modeSelect = modeInput
Camera.CVMode = 'no'

def colorFindSet(self, H, S, V):
camera.colorFindSet(H, S, V)
Expand All @@ -82,4 +82,4 @@ def startthread(self):
fps_threading.start()

def sendIP(self, ipInput):
camera.upperIP(ipInput)
camera.upperIP(ipInput)
53 changes: 24 additions & 29 deletions RPi/setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python3
# File name : setup.py for WAVEGO
# Date : 2022/1/5
# Date : 2025/1/4

import os
import time
Expand Down Expand Up @@ -71,42 +71,37 @@ def replace_num(file,initial,new_num):
break
elif os.system("sudo pip3 install -i http://pypi.douban.com/simple/ --trusted-host=pypi.douban.com/simple websockets") == 0:
break
try:
replace_num("/boot/config.txt",'[all]','[all]\nenable_uart=1\ngpu_mem=128')
except:
print('try again')

try:
replace_num("/boot/config.txt",'camera_auto_detect=1','#camera_auto_detect=1\nstart_x=1')
except:
print('try again')
# try:
# replace_num("/boot/config.txt",'[all]','[all]\nenable_uart=1\ngpu_mem=128')
# except:
# print('try again')

try:
replace_num("/boot/config.txt",'camera_auto_detect=1','#camera_auto_detect=1')
except:
print('try again')
# try:
# replace_num("/boot/config.txt",'camera_auto_detect=1','#camera_auto_detect=1\nstart_x=1')
# except:
# print('try again')

# try:
# replace_num("/boot/config.txt",'camera_auto_detect=1','#camera_auto_detect=1')
# except:
# print('try again')

CMDLINE_FILE = open('/boot/cmdline.txt', 'r')
OLD_LINES = CMDLINE_FILE.readlines()
CMDLINE_FILE.close()

CMDLINE_FILE = open('/boot/cmdline.txt', 'w+')
for EACH_LINE in OLD_LINES:
NEW_LINES = re.sub('console=serial0,115200', '', EACH_LINE)
CMDLINE_FILE.writelines(NEW_LINES)
# CMDLINE_FILE = open('/boot/cmdline.txt', 'r')
# OLD_LINES = CMDLINE_FILE.readlines()
# CMDLINE_FILE.close()

CMDLINE_FILE.close()
# CMDLINE_FILE = open('/boot/cmdline.txt', 'w+')
# for EACH_LINE in OLD_LINES:
# NEW_LINES = re.sub('console=serial0,115200', '', EACH_LINE)
# CMDLINE_FILE.writelines(NEW_LINES)

# CMDLINE_FILE.close()

for x in range(1,4):
if os.system("sudo pip3 install opencv-contrib-python==3.4.11.45") == 0:
break
elif os.system("sudo pip3 install -i http://pypi.douban.com/simple/ --trusted-host=pypi.douban.com/simple opencv-contrib-python==3.4.11.45") == 0:
if os.system("sudo apt-get install -y python3-opencv") == 0:
break



for x in range(1,4):
if os.system("sudo pip3 uninstall -y numpy") == 0:
break
Expand Down Expand Up @@ -140,8 +135,8 @@ def replace_num(file,initial,new_num):
except:
pass

replace_num('/etc/rc.local','exit 0','cd '+thisPath+' && sudo python3 webServer.py &\nexit 0')
#replace_num('/etc/rc.local','exit 0','cd '+thisPath+' && sudo python3 webServer.py &\nexit 0')

print('Completed!')

os.system("sudo reboot")
#os.system("sudo reboot")
Loading