NoIR cameras record pink images!

Hi everyone, I’m back with another little problem, at least this thime will bring lots of fun, I believe.
So, I’m using 2 Pi NoIR cameras and an IR light source I built myself (obviously I used IR leds and the circuit works perfectly). Under the IR source there is a white diffusing glass.
Unfortunately, the captured images are completely pink! I tried to set different parameters in the pipeline, but I wasn’t able to solve the problem.
This is the pipeline I’m currently using:

def gstreamer_pipeline(
    sensor_id=0,
    exposuretime_low = 20000000,
    exposuretime_high = 20000000,
    capture_width=1280,
    capture_height=720,
    display_width=600,
    display_height=340,
    framerate=30,
    flip_method=0,
):
    return (
        "nvarguscamerasrc sensor-id=%d sensor-mode=2 wbmode=1 awblock=false exposuretimerange=\"%d %d\" aelock=false gainrange=\"1 1\" saturation=1 ! "
        "video/x-raw(memory:NVMM), width=(int)%d, height=(int)%d, format=(string)NV12, framerate=(fraction)%d/1 ! "
        "nvvidconv flip-method=%d ! "
        "video/x-raw, width=(int)%d, height=(int)%d, format=(string)BGRx ! "
        "videoconvert ! "
        "video/x-raw, format=(string)BGR ! appsink"
        % (
            sensor_id,
            exposuretime_low,
            exposuretime_high,
            capture_width,
            capture_height,
            framerate,
            flip_method,
            display_width,
            display_height,
        )
    )

This is one of the two images:

thumbnail_image_c2_03

The image is also cut in a strange way, I think this is related to the values of capture width/height
and display width/height, am I right?

I tried to work with the saturation parameter, setting it to 1, but even without it the images were still pink.
Maybe setting saturation=0 will do the job? This shoud also enable the black and white recording according to this gstreamer documentation.

How would you modify the pipeline? The image is definitely not right for my purpose, which is to see the hand vein pattern.

Could you check RAW image if can get normal frame?

Also have a reference to below link.

1 Like

Hi Shane,
how can I get a normal frame? I’m a newbie with gstreamer and opencv.

I checked the reference you linked, and it says
no matter which camera you choose, all of them exhibit a red or pink tint on the outer area
(so I think he’s also referring to NoIR cameras).
But NoIR camera are usually characterized by a pink color during daytime, as showed in this youtube video.
However, I’ll try the solution proposed in the article, which also contains a newer solution (check this topic).
Apparently, first I need to download the tuning profile from waveshare, then download the isp profile.

About the image being cut, I’ll try to change the capture and display resolution.
In this datasheet you can read:

- 8megapixel camera capable of taking infrared photographs of 3280 x 2464 pixels
- Capture video at 1080p30, 720p60 and 640x480p90 resolutions

Do I need to select the same capture resolution as the one in the selected sensor_mode?

Finally, do you suggest turning white balancing on or off? I also tried to play a bit with the gainrange values, like gainrange="2 2" or similar values, but I don’t know if this will be helpful.

I can’t tell which solution can would be working for your case.
You may need to try them to make sure of it.

1 Like

Last question: how do I get a norma frame from the camera?

What do you mean normal frame?
If you need to get frame without pink problem, that could be need tuning process for different lens module.

Filter camera output to get grayscale or other colors?

An IR psychical lens filter should give you natural colors.

1 Like

There is no purpose in using an NoIR camera with a IR lens filter over it.
The problem was a bad tuning of the camera, I solved it by downloading the tuning profile linked by @ShaneCCC