I have not applied the json file to my code. Do you know where or how I can access this?A few random suggestions.....
Have you applied the ov5647_noir.json tuning file in your code? (To get improved colour rendition from the noir sensor.)
Does the camera work and produce imagery in 'normal' illumination conditions?
In your example still the sensor appears to be saturated - or corrupted. Is the module looking through a glass window? (And getting saturated by the reflections from the IR illuminators back into the camera.)
If trying to illuminate a large area try disabling the on-board illuminators and use stand-alone IR security (wide-angle) floodlamps.
Using my code during 'normal' illumination conditions, the camera works just fine
I don't think anything is wrong with the camera hardware as it gives an image during the day time using my code. However, when I use that specific command to test it it gives me the weird image. (its not looking through a glass window). In the dark when I am close to the camera it seems to illuminate me enough and the camera feed gains a red tint, when I step back from it, the feed slowly turns more and more blue.
I can try the last one, I'd have to purchase floodlamps. It seems unnecessary because people say that the camera should work from 3-5 meters in the dark which is all the distance I need.
my code (with sensitive data removed):
Code:
import paho.mqtt.client as mqttfrom picamera2 import Picamera2import mediapipe as mpimport cv2import numpy as np# Camera and MediaPipe setuppicam2 = Picamera2()picam2.preview_configuration.main.size = (640, 480)picam2.preview_configuration.main.format = "RGB888"picam2.start()mpPose = mp.solutions.posempDraw = mp.solutions.drawing_utilspose = mpPose.Pose()# Initialize the MQTT clientclient = mqtt.Client(callback_api_version=mqtt.CallbackAPIVersion.VERSION2)def on_connect(client, userdata, flags, rc): print("Connected successfully to MQTT broker")def on_publish(client, userdata, mid): print("Frame published successfully")def on_disconnect(client, userdata, rc): print("Disconnected")# Setup MQTT authentication and connectionclient.username_pw_set('username', 'password')def generate_frames(): while True: try: frame = picam2.capture_array() frame_resized = cv2.resize(frame, (640, 480)) black_bg = np.zeros_like(frame_resized) rgb_img = cv2.cvtColor(frame_resized, cv2.COLOR_BGR2RGB) result = pose.process(rgb_img) image_landmarks = result.pose_landmarks if image_landmarks: mpDraw.draw_landmarks(black_bg, image_landmarks, mpPose.POSE_CONNECTIONS) _, jpeg = cv2.imencode('.jpg', black_bg) frame_bytes = jpeg.tobytes() # Publish the frame to the MQTT broker under a specific topic client.publish("topic_name", frame_bytes) except Exception as e: print(f"Error generating or publishing frame: {e}")if __name__ == '__main__': try: client.connect("broker_ip", broker_port, 60) client.loop_start() generate_frames() except KeyboardInterrupt: print("Exiting...") finally: client.loop_stop() client.disconnect()
Statistics: Posted by 1parkerj1 — Tue May 07, 2024 12:33 pm