Color Calibration and Magnification issues

Hi, i have assembled my high res microscope with a 40x objective and have started using it after all calibrations.

This is the image from my microscope (ignore the black lines they are most probably dirt on the lens).


This is an image from the OpenFlexure website.

I believe i am facing some image calibration issues which is leading to the colors of staining, etc not showing up in my images. Is there a known fix/config/calibration change for this particular issue?

Also as i am using a 40x objective, the zoom i am getting is not quite 40x what could be the reason and what could i do to increase the zoom with the same specs of the hardware

Edited, see later post: Last things first, that does look to be relatively low magnification for a ×40 lens. I think that there is not much in the build that would change the magnification. An infinity corrected lens in a standard optics module, or the other way round, can make focus a problem, but i think does not change magnification much. Missing out the f=50mm tube lens would I thnk reduce the magnification a lot, but also would make the focal distance long and would introduce a lot of distortion. If it is a low cost objective, mislabelling is possible.

The colour is perplexing. I assume that you have the version of the software from the main website, which is v2.11. With that software and the standard Pi Camera v2 the colour should be good. The colours wash out at the edges, but it should not be blue. You need to run the camera calibration with no sample. In the settings tab , under camera you can disable the calibration and then re-run the calibration. A capture of the empty image before and after calibration might help us to see what is going on.

I think from your other posts you have not got the illumination kit, what exact LED are you using? It might have too much blue and no green.

This is the objective i am using and i have used the f=50mm tube lens too.

This is the empty image before calibration (ignore the black lines and patches, i did some debugging and found out they are some dirt particles on the sensor, i will clean it).

This is the empty image after calibration

I am using the official illumination kit

The image before calibration looks as expected.

After calibration it should be uniform grey. Yours looks slightly purple. The colour correction does not know that you have got dirt, so it tries to correct for the dark libes and dots as well. You can see the very bright region around the dark lines and spots where the background is too bright in order to try to get the local average to be correct. This means that you can see the size of the correction cells used. I don’t think that these lines can affect the overall colour. However you do need to remove the dirt because it will stop the stage calibration working, and it will prevent you from stitching any scans that you make. I would get the sensor clean and try again. Then let us know how you get on.

Cleaning the sensor is difficult. The sensor itself is delicate and it is surrounded by the lens mount. If a dry air duster does not blow the things away, it is very difficult to do any better.

I looked at the magnification in the images in your first post again. I think it is probably correct for 40×. The image you show from the web site will be for a 100× oil immersion objective.

Hi, so it turned out the black lines were actually scratches on the sensor so i replace the picam entirely and tested the microscope on a blood smear sample, I have uploaded an image I captured after calibrating and it is still missing the color calibration I require. What are the next steps I can take to go about fixing the color calibration?

The colour in you image is as expected. The background is neutral. Red blood cells usually do not have much colour, even with staining.

There is more colour in the centre of the image and the colours are more washed out at the edges. This is a factor from the design of the sensor in the Pi Camera which causes colour mixing in our use. It is possible to correct for it in post-processing, as shown in Flat-Field and Colour Correction for the Raspberry Pi Camera Module | Journal of Open Hardware . The OpenFlexure software applies flat field correction as in that paper, but not the colour unmixing. It might be included in the upcoming v3.0.0 software release.

what can i do to get such images, is this a color calibration issue only?

I don’t quite understand what you are asking here. Exactly what is it that you are trying to achieve?
The image in your most recent post has a very prominent blue colour across the backgroud, as well as the sample. This can be done by adjusting the image processing or the illumination, but it will be very specific to a particular application as the colour is deliberately not corrected to make white appear correctly as white.

Sorry I uploaded the wrong image, this is how i want my images to be. I want the realtime view of the microscope to show colors like this, in the original image of my current view that i uploaded, the WBCs have no color.

Is this image a slide that you have, or an image from elsewhere? The cell morphology and the staining look very different.

it is a slide that I have but this image is not from this openflexure microscope, I just wanted to show this for reference as i need that coloring in the WBC that is not there in my current view.

Could my problem be due to the intensity of the illumination?

Thank you for the details.

If you have that slide, it would be useful to see side by side comparison with an image of it from your OpenFlexure Microscope. Preferably the same section of the slide on both microscopes, with some white cells close to the centre as well as towards the edges.

The colour saturation will only be best towards the centre of the field of view because of the colour mixing, but in that centre it should be good.

I agree that the exposure might also be exacerbating the effect. The neutral white point for the flat field correction is set quite high, which can make colours seem more washed out. In the released version of the server software, v2.11, changing the exposure is not very intuitive, but it is available in the settings.

Both the colour mixing and exposure are being addressed in the server v3, but that is not yet stable enough to recommend. The latest v3.0.0-alpha4 has had a lot of attention to the colour settings on the Pi camera and I think that also includes lower default exposure. It may be the exposure change did not quite make it into that version. It also has experimental support for the Pi Camera HQ, which does not have the colour mixing effect - but currently needs further image mode optimisation.

What can I try now in your opinion to try and fix the color calibration?

From what you have shown, all of the basic corrections seem to be working. You are pushing towards the limits of what is possible with the Pi Camera v2.

To understand what more can be possible in your very specific application it will be necessary to see a slide of known colour. A side-by-side comparison of the same portion of the same slide in your two microscopes would give the clearest information. An image of a prepared H&E stained histology sample on your OpenFlexure Microscope might also give some indications, but staining density can be rather different between samples which limits the information we can get.

I understand.

I was under the impression that this image (taken from the openflexure website) was taken using a picam v2 in a openflexure microscope only. Is that not true?

I put the slide under a laboratory microscope i have and it gave desired results as I have stated in the thread above, so I am certain it’s a calibration issue.

One thing I noticed was in my current view the RBCs also appear truly white, which leads me to believe the illumination intensity might be an issue. What can i do to manipulate that?

The images on the web site are all from OpenFlexure microscopes, but they are different samples.

Are you able to capture images from your laboratory microscope? This would really allow us to see how the colour of your OpenFlexure Microscope is performing.

For the illumination question, it is not possible to alter the brightness of the LED, but it is possible to alter the exposure. In the settings tab there is a camera section. There are settings there for exposure and gain. They are not particularly simple to use but might help you to see whether a darker image helps.

I think I was probably the person who took this image. It was a Giemsa stained sample, on an OpenFlexure Microscope with a V2 camera and 100x oil objective.

If your set up is similar to that, and the sample is well stained, you can look at improving the contrast by lowering the exposure time. This is done from Settings → Camera and changing the exposure time.

How does it look if you put another sample under your microscope? Something with strong colours? It’ll be easier for us to understand the issue if you can show us a few samples captured on both microscopes

I’ll add to what others have said: the prominent outlines of the red blood cells in the images you post make it look to me like the contrast is coming from phase rather than absorption: that is what I’d expect if you were looking at unstained cells, and in that case I’d expect they would not be strongly coloured. If the same sample looks very different under another microscope, I am probably just confused - but it would be really useful if you could post an image of the same sample on a different microscope.

Thank you everyone for their help, I am attaching pictures of the same sample taken using both microscopes, maybe this can help us figure out the issue.

Openflexure microscope:

Lab microscope: