Auto-calibrate never completes

Hey OFM Folks!

I am having trouble getting the “Auto-calibrate” function to work. More specifically, no matter how long I wait the auto-calibration routine will not finish. At first I thought I was just being impatient. But after testing it multiple times and giving it several hours each time, I am sure it’s not just my burning desire to explore the microcosmos. Is there a setting which may be causing this?

FYI I am doing this with a class of high schoolers and they’re all experiencing the same problem. This is what we’re using:

2021-06-17-raspbian-openflexure-buster-armhf-lite install zip
Raspberry Pi Model 3 B+
Pi Camera v2
16GB Gigastone MicroSD HC card

One student did report success after 15 minutes. But nobody else can replicate her results.

Here’s a screenshot showing the auto-calibrate function in action (not that you needed to see that):

Thanks!

It looks as though you are using the current full release of the software (v2.9). There are some problems with the automatic calibration which are addressed in the current v2.10.0b1 beta release. In the server v2.9 the autocalibration can get confused. Usually it does complete, but the colour can be very wrong, especially if the lighting becomes much brighter or much dimmer than the last calibration. If you update to the current beta, the disable flat-field correction button works to remove the autocalibration, there is also a separate auto gain and exposure button to set your sample exposure without needing to play with the camera settings manually, and the autocalibration itself is very robust.

If there are reasons that you cannot use the new beta, then if you can find the json file which stores the autocalibration, removing that can reset the problem (I can’t guarantee it won’t just break the installation). Or I have resorted to re-installing the SD card image to start from scratch. Then make sure there is plenty of light before you first run the autocalibration.

@WilliamW You are awesome! Great suggestion. That worked a treat. Unfortunately, it’s probably too late now to update all the high schoolers’ Pis. But I’ll spread the word about the fix! I certainly learned a lot about the OFM through the process of building it remotely with my class.

@WilliamW Uh-oh! Here’s a new problem. The auto-calibrate routine does now complete, the illumination is quite even and the white balance is a nice light gray. However, there are now lines and areas of discoloration in the image. The lines are not always in the same spot. They scan down the image in live view. I wonder if this has something to do with refresh rate? The frequency does seem to change when I change the bitrate settings.

Here’s a shot of onion skin:

Here’s the shot with the blacks lowered in Photoshop Lightroom so you can see the issues better:

The other big issue is that the “live screen disappears”/“connection is dropped” issue is back with a vengeance. Changing the bitrate does not have a noticeable effect. The microscope is only usable for about 30 seconds before it crashes.

Thanks for any help.

Moving lines in live view is I think not uncommon, but I would expect it less in captured images. If it moves it must be some kind of interference. The lines are quite faint in the image before you have enhanced the contrast. I have not got a microscope in front of me at present to look. The camera cables can also cause problems if they are not fully seated in the connector or have a wire cracked. If you have a new cable it is often worth swapping.

For the other issue firstly is there anything in the full log that is flagging a problem. For some general pointer: On the setup I had with a Pi 3B+ it did struggle when I had taken a large number of pictures on an external drive (as in 100sGB, I was testing tiled scans). It also struggled to load a local desktop and display Connect and the Web App, but you are running the lite headless version and I found the full version was fine when not running a local screen. The Raspberry Pi in general is very unhappy when the SD card gets full and will crash or misbehave in creative ways. Similarly the SD cards are used quite heavily in a Pi as they carry the operating system, so can just fail. I don’t know the brand you use specifically. Finally camera cable connection problems can cause what look like unrelated problems on a Pi.

lines down the image could also be due to flicker in the power/room lights: if you are powering the LED from the 5v pin on the microscope (as recommended) there’s not much/any filtering between that and the power supply, so any 50/60Hz ripple can show up as stripes on the image.

Just to check: are you removing the sample before calibrating the lens shading table? That can cause strange artefacts in the image (though these should be strictly static).

I’m mystified by the never-finishing auto calibrate routine; that’s not one I’ve seen before.

When you have the crashing stream, my usual guess is a network problem; if you hit “refresh” to reload the web app (or force reload in the electron app) does it come back, or do you need to restart the server?

1 Like