我如何通过 iPhone 相机计算勒克斯或照度。我计算了所有的 exif 数据,如下所示:
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
我还阅读了http://en.wikipedia.org/wiki/Light_meter并了解到 Lux 是由(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
我不明白这个值指的是什么,例如。N 是来自 Key Value Data 的 ApertureValue 或 FNumber,t 是曝光时间或快门速度。C 的值是多少(320-540 或 250)。我将每个相似的值以不同的组合应用于这个公式,但是当我与一些计算勒克斯值的应用程序进行比较时得到了错误的结果。 我还需要根据照度计算辐照度。
此外,我还通过以下方式计算了捕获图像的亮度:
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
提前致谢。任何帮助将不胜感激。