Skip to content
Snippets Groups Projects
Commit d0f2e3b9 authored by Isaac Espinosa's avatar Isaac Espinosa
Browse files

Adding files for basic Flask web application for interfacing with a Raspberry Pi camera

parent cdb8c4d7
No related branches found
No related tags found
2 merge requests!2Adding FloraGuard Code,!1Adding FloraGuard initial workig version, no object detection yet.
from flask import Flask, render_template
from picamera2 import Picamera2
app = Flask(__name__)
camera = Picamera2()
@app.route('/')
def index():
return render_template('index.html')
@app.route('/capture')
def capture():
camera.start()
camera.capture_file("/static/images/captured.jpg")
camera.stop()
return render_template('index.html', message="Capture successful!")
if __name__ == '__main__':
app.run(host='0.0.0.0', port=80)
Flask
picamera2
body {
font-family: Arial, sans-serif;
margin: 40px;
text-align: center;
}
a {
background-color: #4CAF50;
color: white;
padding: 14px 20px;
text-decoration: none;
display: inline-block;
}
<!DOCTYPE html>
<html>
<head>
<title>Pi Camera App</title>
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/style.css') }}">
</head>
<body>
<h1>Welcome to the Raspberry Pi Camera App</h1>
<a href="/capture">Capture Image</a>
<p>{{ message }}</p>
</body>
</html>
from picamera2 import Picamera2
picam2 = Picamera2()
picam2.start_and_capture_file("test.jpg")
\ No newline at end of file
from picamera2 import Picamera2
picam2 = Picamera2()
picam2.start_and_record_video("test.mp4", duration=5)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment