Friday, December 21, 2012

Android App for Photographers

I had found out recently that my mom had an old 35mm SLR, with some really great lenses, that I didn't know about. Since she wasn't using it she let me borrow it. 

Thanks Mom
One problem I had was what should I set the film speed too? 

Usually a digital camera would just do this for me

Well I found a nifty equation that relates ISO speed, aperture, luminance and exposure time on Wikipedia. 


Where N is the aperture (f-stops), L is luminance (lux), S is the film speed (ISO) t is the exposure time (seconds) and K is a constant (14 for Pentax cameras). 

I could find N, K and S fairly easily as they were given, but what about L? I didn't have a lux meter lying around. But, I did have an Android device with a light sensor and found out there were free lux meter apps

But the apps had adds in them! 

Then I found out that it was a pretty trivial excise to get light sensor data and print it to the screen. Since Google has made the Android app development environment pretty open all I had to do was fire up my Eclipse IDE and make my own lux meter app. 

And I did, but why stop there? Since I eventually wanted to calculate the ideal exposure time for a scene and I didn't really want to do the calculations every time I wanted to take a shot, I decided to extend my app to let me input aperture, film speed and the calibration constant and my phone would detect the luminance and calculate the exposure time for me. 

It took me about an evening to relearn the Android API and implement that well defined functionality. 

Pretty cool huh?
I put a large button on the bottom to let the user press to sample the luminance because most light sensors are on the face of the device, which means that the user must point the screen away from them to sample the luminance from their subject. A really big button would let them press somewhere on the bottom of their screen to do that. 

I decided at this point to actually make this an actual app at this point. Which meant designing a logo. And I, of course, chose a camera diaphragm for the logo because nothing says photography like a diaphragm. 

Surprisingly it took more math to design the logo than the app actually used. 

I swear these are not satanic symbols
Once I mapped all the coordinates for all the triangles in the diaphragm I wrote the image in an SVG file and rasterized it to a png. 

It's like the logo of some '60s Bond villan's criminal organization
At this point I had to think about licensing, since this was a pretty trivial app I'm sure there is a lot that could be done to improve it, so I decided to license it under the GNU General Public License to ensure that it would always exist to let people use it how they want and modify it to fit their needs. 

One curious thing: this decision forced me to make the app's underlying code better. Since people might look at the source code I made I felt that the code represented myself as a developer and I want to give the best impression I can. So I removed as much redundant code as I could, separated classes into their own separate files, commented key parts of the code and remove hard coded values. I basically wanted to make it a model Android app. 

That took a few days but I'm confident to say that this is the best work I can deliver. 

So without further deliberation, I present my Android exposure time calculator:




And if you're inclined you can download the source code too. 



I haven't put it up on the Play store. The developer application costs $25 and I haven't decided if I want to pay that right now, but if I do I'll definitely upload it.