Hi, I recently tried setting up the HD camera on a pi 4 model B, installed the hardware correctly I believe, and setup a flask server to serve me a feed so that I could start focusing the camera
from flask import Flask, Response
from picamera2 import Picamera2
import cv2
import time
from PIL import Image
import io
app = Flask(__name__)
picam2 = Picamera2()
picam2.configure(picam2.create_video_configuration(main={"size": (1080, 720)}))
picam2.start()
def generate_stream():
while True:
image = picam2.capture_image("main")
buf = io.BytesIO()
image.save(buf, format='JPEG')
frame = buf.getvalue()
yield (b'--frame\r\n'
b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n')
time.sleep(0.05)
@app.route('/')
def index():
return '<h1>Raspberry Pi Camera Stream</h1><img src="/video_feed">'
@app.route('/video_feed')
def video_feed():
return Response(generate_stream(),
mimetype='multipart/x-mixed-replace; boundary=frame')
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000, threaded=True)
But the most focused an image I could get required me dropping the exposure to baiscally nothing and having the focus set to as close to near as possible, the back plate was also screwed in as tightly as possible (but I did test loose on both) Any ideas as to where I might be going wrong - or if its an issue with the camera / lens?