|
|
|
@ -32,7 +32,7 @@ picam2 = None
|
|
|
|
|
def cameraon():
|
|
|
|
|
global picam2
|
|
|
|
|
picam2 = Picamera2()
|
|
|
|
|
picam2.configure(picam2.create_video_configuration(main={"format": 'XRGB8888', "size": (640, 480)}))
|
|
|
|
|
picam2.configure(picam2.create_video_configuration(main={"format": 'XRGB8888', "size": (320, 240)}))
|
|
|
|
|
picam2.start()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -70,7 +70,7 @@ def gen_frames(): # generate frame by frame from camera
|
|
|
|
|
@app.route('/control/sendit', methods=['POST'])
|
|
|
|
|
def send_command():
|
|
|
|
|
# 定义目标 IP 地址、端口和路由
|
|
|
|
|
ip = "192.168.60.204"
|
|
|
|
|
ip = "192.168.100.101"
|
|
|
|
|
port = 3000
|
|
|
|
|
route = "sendit2"
|
|
|
|
|
|
|
|
|
@ -105,7 +105,8 @@ def capture_image():
|
|
|
|
|
# 将帧保存为图片
|
|
|
|
|
try:
|
|
|
|
|
cv2.imwrite(photo_path, frame)
|
|
|
|
|
return f"Photo saved at {photo_path}"
|
|
|
|
|
return send_file(photo_path, as_attachment=True)
|
|
|
|
|
|
|
|
|
|
except Exception as e:
|
|
|
|
|
return f"Failed to save photo: {str(e)}"
|
|
|
|
|
|
|
|
|
|