How I calculate the sunroof or light using the iPhone Camera.I calculate all exif data that:
key = FocalLength, value = 3.85 key = MeteringMode, value = 5 key = ShutterSpeedValue, value = 4.591759434012097 key = ExposureProgram, value = 2 key = FocalLenIn35mmFilm, value = 32 key = SceneType, value = 1 key = FNumber, value = 2.4 key = PixelXDimension, value = 480 key = ExposureTime, value = 0.04166666666666666 key = BrightnessValue, value = -0.2005493394308445 key = ApertureValue, value = 2.526068811667588 key = Flash, value = 32 key = ExposureMode, value = 0 key = PixelYDimension, value = 360 key = SensingMethod, value = 2 key = ISOSpeedRatings, value = ( 1250 ) key = WhiteBalance, value = 0
I read http://en.wikipedia.org/wiki/Light_meter and found out that Lux is calculated (N*N*C)/tS
Where N is the relative aperture (f-number) t is the exposure time ("shutter speed") in seconds S is the ISO arithmetic speed C is the incident-light meter calibration constant
I do not understand what this value refers to, for example. N - ApertureValue or FNumber from the key value data, t - exposure time or shutter speed. And what is the value of C (320-540 or 250). I applied all similar values ββin another combination to this formula, but I got the wrong result when comparing with some application that calculates lux values. I also need to calculate the illumination from the illumination.
In addition, I calculated the brightness of the captured image as well:
UIImage* image = [UIImage imageNamed:@"image.png"]; unsigned char* pixels = [image rgbaPixels]; double totalLuminance = 0.0; for(int p=0;p<image.size.width*image.size.height*4;p+=4) { totalLuminance += pixels[p]*0.299 + pixels[p+1]*0.587 + pixels[p+2]*0.114; } totalLuminance /= (image.size.width*image.size.height); totalLuminance /= 255.0; NSLog(@"Image.png = %f",totalLuminance);
http://b2cloud.com.au/tutorial/obtaining-luminosity-from-an-ios-camera
Thanks in advance. Any help would be appreciated.