Thesis Blog: Field Testing My Stupid Camera
I don't know how you start your day, but for me, I am starting to have a feel of what I like to do in the morning. I wake up, check whether I am hungover, hit the shower, tidy up my bed, iron my shirt, get pumped-up!, ask google the weather, avoid the elevator, get down the stairs, say hi to the Ajashi, get my daily sandwich from the Ajumma store and reach the lab at 8.
Yeah seriously, times have really changed.
During all this time, I get my daily dose of PRI daily podcast. It's a news podcast hosted by Marco Werman and they cover range of topics from music to entertainment to bombings to the next great disaster, Donald Trump. They say listening to the news in morning is bad for your mood, but for me, it has almost the opposite effect. Call me cynical but by listening to all the shit people have to face in their daily lives around the world, I feel quite happy where I am.
I guess I am a dick. I seem to feel quite alive after every sad, heart wrenching news. Amazing.
Unfortunately things change very quickly when I reach the lab. All the happiness seems to melt as the day passes by as I desperately try wrapping up my thesis. My defense is only about 14 days away and I still don't seem to have solid results to show.
The issue came this week when I had to take my camera out for field testing. Taking images of the earth is much like taking images of the clouds, sky and the buildings. The light that reaches space is the reflected light from the sun which is then picked up by the camera and turned into image. The same principle applies when you want to take a picture inside earth too.
|The camera got some clothes on|
To verify whether the camera takes images in bright conditions, I took my camera for a ride. From one building top to the next, I set camera up, took some glorious shots (or so I thought) and moved on to the next. The only problem though was that the camera would just take saturated, white images.
In imaging terms, the problem was with over-exposure. While the camera can take images indoors, it does not necessarily take images outside. The lighting conditions, especially on a clear day is quite brilliant and the camera has a hard time adjusting the amount of light it wants to take.
The MT9D111 image sensor has a System-On-Chip (SOC) which is supposed to take care of that. After my processor commands the SOC to set the sensor to auto-exposure, the camera should not have had such issues. However, like most things in life, things don't work out as planned.
There are a couple of ways to deal with such problems. One is to reduce the amount of light entering to the sensor in the first place. That's done by a mechanical shutter, however, the optics is passive and does not have a shutter. Another way is to set the gain settings low, by doing so whatever the amount the sensor reads, the Analog to Digital Converter (ADC) will lower the voltage that's coming out from the sensor.
The MT9D111 developer's guide has this to say:
|Yep, didn't work. Now what?|
I actually did try doing all of the above but results were pretty bad:
You will notice not just the NIR sneaking in, but the color is off which means all of the settings (auto-white balance, auto-exposure) were all well down the dirtiest toilet.
Was I doing something wrong?
I don't know why but I did make some changes to my software. It's basically the same settings but instead of setting the auto-white balance and the auto-exposure first, I declared the image resolution and then the auto white and exposure settings. I also used a stock lens (no info in the f#) and took the image at similar time. The improvements are palpable.
|Overlapping picture from camera to picture from Nexus5|
|There was a time I used to complain about my phone's camera|
The results have certainly improved for low-light settings. These are perhaps some of the conclusions I can make from this week's Building to Building jump.
1) Datasheets are dodgy. Even though you follow them religiously, the initialization steps don't match up with the results sometimes. You have to play around with the software.
2) Registers are being written correctly, however, I don't see other way but to brute-force your way through getting better results. Hit & Trial, Hit & Trial.
I still have some work to do with the auto-brightness settings and see if I can lower down the target (current value for ae.target=0x3C) but i am planning to tone it down before the high-brightness test tomorrow from top of 301.
Finger's crossed on this one.