Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4476

Camera board • OV5647 IR Illumination not working very good

$
0
0
Hi All,

I decided to cut the IR Illumination Discussion to a camera more likely supported by Raspberry PI.

So a while back I got this camera.
Waveshare Camera Module Compatible with All Version of Raspberry Pi Night Vision 5MP OV5647

Looks a lot like this camera, which I also have, I just haven't taken it out of the box yet:
https://www.amazon.com/gp/product/B07DN ... =UTF8&th=1

The PICam2 library recognizes it:

0 : ov5647 [2592x1944 10-bit GBRG] (/base/axi/pcie@120000/rp1/i2c@80000/ov5647@36)
Modes: 'SGBRG10_CSI2P' : 640x480 [58.92 fps - (16, 0)/2560x1920 crop]
1296x972 [46.34 fps - (0, 0)/2592x1944 crop]
1920x1080 [32.81 fps - (348, 434)/1928x1080 crop]
2592x1944 [15.63 fps - (0, 0)/2592x1944 crop]


I used chatgpt to suggest ways to improve both daylight and IR performance, and I figured this would be the camera to do it because it already had the IR Illuminators on it and so it must respond to the IR Light.



The Tuning File seemed to work well for color correction during the day, but the output was no where near as crisp as the PI Cam module 3 as far as color and crispness at near the same resolution. The Pi Camera 3 wide Field of view was so much better and images sharper. Well, I bought that Camera back in 2016.

Code:

    tf = Picamera2.load_tuning_file("calibration/ov5647_noir.json",dir='.')    picam2 = Picamera2(tuning=tf)    #picam2 = Picamera2()    w = 2592          h = 1944       picam2.configure(picam2.create_video_configuration(main={'format': 'YUV420', "size": (w, h)})) 
One thing that was really aggravating was that there was two different ways to setup the configuration. Either I used the video or the still image function. If I used the still image configuration, the MJPG encoder would not work!

Code:

    picam2.configure(picam2.create_video_configuration(main={'format': 'YUV420', "size": (w, h)}))     # Set up the camera configuration for low-light conditions    '''    camera_config = picam2.create_still_configuration(        main={            "size": (w, h),  # Adjust resolution as needed            "format": "RGB888"    # High-quality image format        },        controls={            "AnalogueGain": 8.0,  # Increase gain for brightness (max 16.0)            "ExposureTime": 100000,  # Set exposure time in microseconds (e.g., 100ms)            "Brightness": 0.2,  # Brightness adjustment (range: -1 to 1)            "Contrast": 1.5,    # Increase contrast            "Saturation": 1.2,  # Adjust color saturation            "Sharpness": 1.5,   # Enhance sharpness            "FrameRate": 5.0    # Lower frame rate for longer exposures        }    )    '''

Question 1: , if I use video vs still image, will the configuration/camera controls be applied different? If they are, then .... there needs to be a BIG RED WARNING in the documentation that this will take place. If it doesn't really matter, then why would the MJPG encoder fail? Bug?

So anyway I started tweaking it this way:

picam2.camera_controls['AnalogGain'] = 8.0
picam2.camera_controls['ExposureTime'] = 200000
picam2.camera_controls['Brightness'] = 0.2
picam2.camera_controls['Contrast'] = 1.5
picam2.camera_controls['Saturation'] = 1.2
picam2.camera_controls['Sharpness'] = 1.5
picam2.camera_controls['FrameRate'] = 5.0
picam2.camera_controls['ISO'] = 800
#picam2.camera_controls['AwbMode'] = 'off'
#picam2.camera_controls['AwbEnable'] = (False, True, None)
#picam2.camera_controls['ExposureMode'] = 'off'


Not much difference, then like this:

Code:

   # picam2.framerate = 15  # Lower framerate for better exposure in low light       # Disable auto settings   # picam2.awb_mode = 'off'  # Disable Auto White Balance   # picam2.awb_gains = (1.5, 1.5)  # Manually set white balance gains   # picam2.exposure_mode = 'off'  # Disable Auto Exposure   # picam2.shutter_speed = 200000  # Set exposure time (microseconds, e.g., 200ms)   # picam2.iso = 800  # Set ISO for light sensitivity    # Brightness and Contrast   # picam2.brightness = 60  # Adjust brightness   # picam2.contrast = 20  # Adjust contrast

Really wish there was one best-practice way to do this because when there are 3 different ways, it's hard to narrow down if it's some bug in the methodology or is it in the settings or groups of settings etc...

No matter what kind of tweaking I did, it really didn't seem to change the outcome at all.

This was the best I could get out of it from about 15 feet away:
cap1.png
Compare and contrast this to another security camera right by it using the same IR Illuminator which could see out 200-250 feet.
cap2.png

So now I am wondering if this other camera brand is just going gray scale, and processing the Luminescence or other channel and scaling the it up to keep the contrast between pixels, but not washing out the image. I don't necessarily need color at night, but a good grayscale image in which I can do object detection/recognition on is what I am after.

Statistics: Posted by UltimateCodeWarrior — Wed Jan 15, 2025 7:35 pm — Replies 0 — Views 24



Viewing all articles
Browse latest Browse all 4476

Trending Articles