Page 1 of 1

Images progressively blurry as the day goes on

Posted: Fri Feb 13, 2015 11:08 pm
by blackketter
I'm working on a long-term time lapse project with a B+ and camera board and I'm seeing some strange blurriness in the images as the day gets brighter. Here are two examples, taken at 10am and 11am this morning. The raspistill parameters were exactly the same:

Image

Image

From the EXIF data visible to Aperture, I can only see that the shutter time was shorter at 11.

As the day goes on they get progressively more blurry, then at night it sharpens back up.

Anybody have a suggestion? It is warm up there and gets warmer as the day progresses. Is sharpness correlated with temperature?

Thank in advance!

Re: Images progressively blurry as the day goes on

Posted: Sat Feb 14, 2015 2:12 pm
by towolf
I can only say that I observed this too when I did day and night timelapses. When it got really bright during the day the image got fuzzy.

Re: Images progressively blurry as the day goes on

Posted: Sat Feb 14, 2015 4:40 pm
by jamesh
Weird. Possibly be the lens warming up and distorting?

Re: Images progressively blurry as the day goes on

Posted: Sat Feb 14, 2015 4:45 pm
by PiGraham
The most noticable difference between those images is change in contrast. In the 'blurry' one the dark areas are not very dark. Could it be light on the window or lens as the sun moves?

Re: Images progressively blurry as the day goes on

Posted: Sat Feb 14, 2015 5:07 pm
by blackketter
PiGraham wrote:The most noticable difference between those images is change in contrast. In the 'blurry' one the dark areas are not very dark. Could it be light on the window or lens as the sun moves?
If you right-click on those images and see them in full resolution, you can see that the focus has changed substantially. (And it gets worse over the day.) I'm less concerned with the contrast change (as the sun has moved a bit), though the changes may be related.

The camera is behind a window and is shielded with a hood to prevent reflections from the inside making their way into the image.

As far as the lens distorting, that's a possibility. If you compare the two images you can also see a shift of the whole image, as well as a non-uniform smear of the image (directional, not just unfocused blur).

Re: Images progressively blurry as the day goes on

Posted: Sat Feb 14, 2015 5:17 pm
by jbeale
I think the lens-sensor distance difference between sharp focus and not-sharp on this camera is measured in microns. So I think thermal expansion as ambient temperature changes could do it.

Re: Images progressively blurry as the day goes on

Posted: Sat Feb 14, 2015 5:19 pm
by blackketter
jbeale wrote:I think the lens-sensor distance difference between sharp focus and not-sharp on this camera is measured in microns. So I think thermal expansion as ambient temperature changes could do it.
Aha. That makes sense. I'll get out my heat gun and do a little bit of (gentle) experimenting. Maybe I need a better/different lens. I'd totally appreciate suggestions!

Re: Images progressively blurry as the day goes on

Posted: Sat Feb 14, 2015 5:25 pm
by PiGraham
blackketter wrote:
PiGraham wrote:The most noticable difference between those images is change in contrast. In the 'blurry' one the dark areas are not very dark. Could it be light on the window or lens as the sun moves?
If you right-click on those images and see them in full resolution, you can see that the focus has changed substantially. (And it gets worse over the day.) I'm less concerned with the contrast change (as the sun has moved a bit), though the changes may be related.

The camera is behind a window and is shielded with a hood to prevent reflections from the inside making their way into the image.

As far as the lens distorting, that's a possibility. If you compare the two images you can also see a shift of the whole image, as well as a non-uniform smear of the image (directional, not just unfocused blur).
I did look at the full size images.

Note that a soft image is not the same as poorly focused image. Poor focus will give an soft image, but other things can produce similarly soft images that refocussing will not improve.

As an example, 'soft focus effect' can be acheived by putting a lightly diffusing filter over the lens (cling film is sometime used) . This does not alter the focus, but produces a softened image.

I'd look at scattering on the window and in the air, which will soften an image and reduce contrast.
If the plastic lens housing gets hot it could distort, but it seems unlikely that it would be sufficient to notice.
The Lens-sensor distance is small, but it's the proportionate change that matters. Any thermal expansion of the tiny housing will be tiny.

If this is a focus problem you should find that you can eliminate the effect by refocussing the lens later in the day. If that is not possible the effect is not lens focus.

You could try a shroud on the outside of the window.

Monitor temperature to look for correlation with temp while eliminating lighting changes.

If you have a widow facing away from the sun late in the day I suggest you set the camera there for a test.

Another thing you could try is to use a camera phone to take pictures of the scene at the same time of day from the same spot and see if they show something similar or not.

Re: Images progressively blurry as the day goes on

Posted: Sat Feb 14, 2015 5:59 pm
by blackketter
Ok, quick test verifies that heat is an issue. Below are hot and cold pictures, after heating another camera module a bit with a hot rework station (set to max 100C, though I don't think it got that hot), then letting it cool for a minute:

Image
Image

Not sure how to verify if it's the sensor or the lens assembly that's affected by the heat...

Re: Images progressively blurry as the day goes on

Posted: Sat Feb 14, 2015 6:07 pm
by PiGraham
Can you refocus a warm camera?

Re: Images progressively blurry as the day goes on

Posted: Sat Feb 14, 2015 6:12 pm
by PiGraham
Just checking. Is this a standard Pi camera, or a Pi Noir?

Re: Images progressively blurry as the day goes on

Posted: Sat Feb 14, 2015 6:19 pm
by jbeale
Nice experiment; clearly temperature has an effect! My first guess is that it's simply the plastic lens housing expanding with temperature, although it could also be the lens itself (if it is also plastic) deforming slightly as well. I have refocused these (nominally fixed-focus) camera modules with two pairs of small pliers but it is a bit cumbersome, tricky to do precisely, and you are still left with a camera that is in focus at only one temperature. I have several aftermarket (ebay) versions with M12 lenses, and one conversion I did myself, but I can't say they have any better performance. Actually for absolute resolution I think they are worse than the original module, I got them only because I needed a longer focal length.

Re: Images progressively blurry as the day goes on

Posted: Sat Feb 14, 2015 6:22 pm
by PiGraham
The point of refocusing it to confirm that the effect is due to movement of the lens. If refocusing correct the image sharpness then the issue is that the lens-sensor distance has changed. If it is not possible to restore sharpness by focusing the camera something else is the cause.

Re: Images progressively blurry as the day goes on

Posted: Sat Feb 14, 2015 6:25 pm
by PiGraham
The lens housing is fixed to the pcb with a sticky pad. Press the housing and it move a bit. If that has anything to do with it then perhaps fixing the housing to the PCB with epoxy would cure it.

Re: Images progressively blurry as the day goes on

Posted: Sat Feb 14, 2015 7:09 pm
by blackketter
Wow, thanks for the help everybody!

- Pressing on the warm lens doesn't affect focus, I can't get it to move appreciably. So I don't think it's the adhesive/gasket.

- Refocusing the lens while warm brings it back into focus. It goes out of focus when it cools down. This implies that it's the lens assembly and not the sensor.

- These are regular (not NoIR) cameras. One is authentic, the other is a VILROS clone. Both exhibit the same behavior. (I didn't realize that the first camera I bought was a clone, saw this behavior and then bought a new one. The clone seems to be a bit worse than the authentic one in this regard.

Re: Images progressively blurry as the day goes on

Posted: Sat Feb 14, 2015 7:30 pm
by gordon77
How much is the temp in your room varying during the day?

Re: Images progressively blurry as the day goes on

Posted: Sat Feb 14, 2015 9:10 pm
by blackketter
gordon77 wrote:How much is the temp in your room varying during the day?
A lot. It's a south-facing window. At night it probably gets down to around 10C.

Just broke out the cooking probe thermometer. Wow. The temperature at the lens is around 59C right now, which is probably the peak.

So, yeah, probably around a swing of 50C.

I think the spec for the camera is to 50C, so right now I am operating outside of spec. But I think it goes out of focus below that point. I'll check in the morning and report back.

Re: Images progressively blurry as the day goes on

Posted: Sat Feb 14, 2015 9:14 pm
by gordon77
As you say wow!

Re: Images progressively blurry as the day goes on

Posted: Sat Feb 14, 2015 9:25 pm
by PiGraham
60 C? is it in direct sun?
Use a sun shade?
Presumably the air temperature in the room is much cooler than that. You could use a fan.

Re: Images progressively blurry as the day goes on

Posted: Sat Feb 14, 2015 10:25 pm
by poing
PiGraham wrote:The lens housing is fixed to the pcb with a sticky pad. Press the housing and it move a bit. If that has anything to do with it then perhaps fixing the housing to the PCB with epoxy would cure it.
The sensor/lens package is fixed with a sticky pad so that doesn't change anything.

OP, you obviously have to keep the camera in the shade.

Re: Images progressively blurry as the day goes on

Posted: Sat Feb 14, 2015 11:03 pm
by PiGraham
poing wrote:
PiGraham wrote:The lens housing is fixed to the pcb with a sticky pad. Press the housing and it move a bit. If that has anything to do with it then perhaps fixing the housing to the PCB with epoxy would cure it.
The sensor/lens package is fixed with a sticky pad so that doesn't change anything.

OP, you obviously have to keep the camera in the shade.
My thought was that the fixing to the PCB might be susceptible to heat, rather than the plastic housing itself. It doesn't seem that this is the case, but it was worth considering. If the glue moved then more rigid glue could be a fix. There is some flex in the pad. I can see the housing move relative to the PCB with finger pressure.If it was epoxied to the board it wouldn't do that.

It is very surprising that the housing itself can distort enough to disturb the focus, but it seems that may be the case.

Shading & cooling seem to be the way to go.

Re: Images progressively blurry as the day goes on

Posted: Fri Mar 27, 2015 1:43 pm
by ZuLuuuuuu
Hello we are facing a similar problem:

We are doing a calibration process which requires a very stable camera with fixed FOV. We can calculate the difference between two images of the same scene using our calibration software and we saw that after we first boot up Raspberry, while we are getting images from the camera module, the FOV of the camera changes slightly. It changes as much as 1 pixel in first 5 minutes and almost 2 pixels in about 20 minutes. Then the change slows down.

We saw this thread, our guess is also that it is something to do with temperature but we are not sure. The temperature of the room we are in is quite stable. Also we tried hard not to shake the camera during the tests. So if it is temperature, then even the internal temperature of the camera causes FOV changes.

We tried separating the plastic black housing from the PCB and fixing the housing via a cramp but it is still changing. So the glue thing between housing and the PCB might not be the problem.

My questions are:

1) Do you think it is the temperature?

2) If yes, which part is the most susceptible to heat changes? The lens? The plastic housing? The sensor? The glue that joins the plastic housing and the PCB?

3) What can we do to stabilize the camera FOV?

Re: Images progressively blurry as the day goes on

Posted: Fri Mar 27, 2015 10:51 pm
by poing
The sensor will generate a little heat with each exposure, the longer the exposure the more heat.