Extremely low-light fluorescence imaging with Arducam B0333 Pivariety on RPi 4B and gstreamer noise?

Hi, I’m trying to use the B0333 Pivariety low-light camera module inside a spectroscope for fluorescence imaging, so I need to detect extremely low amounts of light. The camera is attached to a Raspberry Pi 4B, the drivers and libcamera are installed, and I can already capture an image with the libcamera-still command.

Two things are bugging me:

  1. When I stream video via gstreamer, occasionally I get image problems that look like noise over a few lines of pixels.

  2. I can’t find much info about the available settings for manual capture. On the website only the -shutter setting is explained. In full darkness with the housing completely closed the camera shows only a black image and I can’t see any lines on the spectrometer. But when I open the housing a little and let a small amount of stray light in, the camera picks it up and even shows the spectrum lines weakly. So the capability to detect them even in darker conditions seems to be there.

How should I best adjust the settings to accommodate extremely low light detection? Do you have any experience with this? Are there other settings like sensitivity that I can adjust?

Thanks for the detailed description. To make sure we understand exactly what you’re seeing, could you take a short video showing the problem? That would help us get a better grasp of the issue before we suggest changes.

Sure, let me describe two photos I took in the meantime because they show the difference really clearly:

Photo 1: I can see a few lines with the spectrum visible in the middle (light coming in through the optical fibers), plus a bright spectrum on top of the picture (housing slightly open, so ambient light came in).

Photo 2: housing fully closed, no other parameters changed, the light from the optical fibers is unchanged — but the spectrum in the middle is much weaker now, only green is visible.

When I open both photos on my Windows PC, the exposure time in both is 1/8 sec and ISO=10748. So I don’t understand why the two images differ so much.

A few questions:

  • Does the B0333 have some inbuilt image processing that isn’t accessible to the user?
  • Why is the exposure time 1/8 sec when the shutter is set to 35000?
  • How can I get reproducible images and actually detect very small amounts of light?

For reference, the manual command I used was:

libcamera-still -o test.jpg –shutter 35000 –gain 200

with analog gain 200 (maximum) and exposure 33259 (maximum).

Thanks, that’s a very helpful description and I understand the issue. Regarding this abnormal low-light behavior, honestly we haven’t tested it in exactly this way before.

One important thing: based on the RPi ISP process, the ISP will adjust the exposure and analog gain in order to reach the AE (auto exposure) target. If you use manual exposure mode, the ISP should not be adjusting them. So the exposure time behavior you describe does look very strange to us.

Let me test this on our side and I’ll reply as soon as possible.

Update: I ran a test here and everything looks normal.

What I did: put the sensor in a dark box with just a very little light, then captured an image with:

libcamera-still -o test.jpg –shutter 35000 –gain 200

Result: the exposure time is OK. I’ve attached the two result images so you can compare with what you’re getting.

Interesting, thanks for testing. Let me describe my dark box scenario exactly, because it’s the part that makes no sense to me.

I have a dark box with a very small, very dim light in it that is barely visible in the image even in the dark environment. When I lift the lid a little and let outside light in, the small light is seen much better — even though distracting light also comes in from outside. All settings are the same in both cases.

Shouldn’t the small light be seen much better when it’s totally dark? This really doesn’t make sense to me.

I need to detect extremely small amounts of light from fluorescent samples, so small that they can’t be seen with the naked eye. I need to tune this camera perfectly. Any tips on how to get the most out of it for detecting extremely small amounts of light?

I get what you’re dealing with. A couple of thoughts:

One thing you can try is the denoise parameter. Add it to your capture command like this:

libcamera-still -o test.jpg –shutter 35000 –gain 200 denoise=cdn_off

Give that a shot and let me know what you see.

I finally figured out how to get more consistent results by using the config.txt file and setting as many values as possible manually:

analoggain=1000
shutter=1000000
immediate=
sharpness=2
ev=0
saturation=1
brightness=0
contrast=1
denoise=off
timestamp=

That gives relatively consistent results. But I still have one issue: I can’t set awbgains to turn AWB off. No matter whether I set it to 1,1 or 5,5 or 100,100, the image is always totally black and the exposure time is just one or two seconds.

Can you explain why this happens?

Two things come to mind for your problems:

  1. The awbgain issue: it may just be that the environment is too dark, so the effect of awbgain isn’t obvious.

  2. Please try updating the firmware — this may resolve the shutter option behavior you’ve been seeing.

I’ve sent you the firmware file and the flashing instructions through private message, please check them and try the update.