简体   繁体   English

如何使用iPhone相机测量房间中可见的蓝光强度?

[英]How to measure visible blue light intensity in a room using iPhone camera?

I see that the algorithm for measuring luminance in LUX for a pixel is ( obtained from here ) 我看到用于测量像素的LUX亮度的算法是( 从此处获得

double luminance = r*0.299 + g*0.587 + b*0.114;

I'm interested in knowing the intensity of a given picture's light in the "blue" spectrum, rather than pure luminance. 我有兴趣了解给定图片在“蓝色”光谱中的光强度,而不是纯亮度。 How can this be done? 如何才能做到这一点? Would simply taking the weighted "blue" value of each pixel in a camera image and somehow averaging/adding them do the trick? 是否会简单地获取摄像机图像中每个像素的加权“蓝色”值,然后以某种方式平均/相加来达到目的?

Thank you for your input! 谢谢您的意见!

Luminance is intensity per area. 亮度是单位面积的强度。

The formula you posted isn't about converting red, green, and blue intensity to total luminance or vice-versa; 您发布的公式不是要将红色,绿色和蓝色的强度转换为总亮度,反之亦然; it's just about weighting red, green, and blue luminance to get total luminance. 它只是对红色,绿色和蓝色亮度进行加权以获得总亮度。 You've already got blue luminance, so the relevant formula for your purposes is: 您已经具有蓝色亮度,因此用于您目的的相关公式为:

b

Or, if you prefer: 或者,如果您愿意:

b*0.114

For the other part, it depends on what you're asking, but it's probably somewhere along this path: 另一方面,这取决于您的要求,但这可能在此路径上:

The intensity for each pixel is the luminance for that pixel times the area of the pixel. 每个像素的强度是该像素的亮度乘以像素的面积。

The intensity for the whole array is the sum of all of those separate intensities. 整个阵列的强度是所有这些单独强度的总和。

The luminance for the whole array is the intensity for the whole array divided by the total area of the array, and it should be obvious that's also trivial. 整个阵列的亮度是整个阵列的强度除以阵列的总面积,很明显这也是微不足道的。

The luminance for the whole room is… well, presumably the whole point here is that you're making the assumption that it's roughly the same as the luminance for the camera array, so by assumption it's just the same as the last value. 整个房间的亮度是……好吧,大概这里的要点是,您假设它与摄像机阵列的亮度大致相同,因此通过假定它与最后一个值相同。

The intensity for any plane within the whole room is then the luminance times the area of that plane, and the intensity for the room as a whole is then the sum across all those planes, but those probably aren't very useful to you. 那么,整个房间中任何平面的强度就是亮度乘以该平面的面积,然后整个房间的强度就是所有这些平面的总和,但是这些对您可能不是很有用。

The intensity for a picture is just the intensity across the camera array at the time you took the picture. 图片的强度只是您拍摄图片时相机阵列上的强度。 That's probably more useful than the intensity of the room. 这可能比房间的强度还要有用。

@abamert already gave a correct answer. @abamert已经给出了正确的答案。 I'm adding a little bit of details. 我要添加一些细节。

The term luminance in digital imaging and video is common, but not the best choice because it may create confusion with the photometric term. 数字成像和视频中的术语luminance很常见,但不是最佳选择,因为它可能与光度学术语混淆。 A better choice would be luma . 更好的选择是luma The article the OP links to does exactly this confusion (despite actually linking to the photometric term entry on wikipedia which, ironically, happens to start with the note Not to be confused with Luma ). OP链接到的文章确实做到了这种混乱(尽管实际上是链接到Wikipedia上的光度学术语条目,具有讽刺意味的是,该注释恰巧以注记“ 不要与Luma混淆”开头)。

LUX is a unit of measure of luminous intensity and the value you get from pixel data cannot be related to such a measure unless you are using a perfectly calibrated device, work with raw data and also know for sure the actual response curve. LUX是发光强度的度量单位,从像素数据中获得的值不能与这种度量相关,除非您使用的是经过完美校准的设备,使用原始数据并且还要确定实际的响应曲线。 You are not getting LUX or Candles or anything precise from a camera image. 您没有从相机图像中获得LUX或Candles或任何精确的东西。

There are several color models and each may have several color spaces. 有几种颜色模型,每种颜色模型可能都有几种颜色空间。 Your image data is in RGB, but RGB is a color model, not a color space. 您的图像数据使用RGB,但是RGB是一种颜色模型,而不是颜色空间。 There are several RGB color spaces. 有几种RGB颜色空间。

The formula Y = R*0.299 + G*0.587 + B*0.114 is the standard formula to compute the Y luma as defined in the NTSC color space from data in the CIE-RGB color space (note that Y, R, G and B are all values between 0 and 1). 公式Y = R*0.299 + G*0.587 + B*0.114是用于根据CIE-RGB颜色空间中的数据计算NTSC颜色空间中定义的Y亮度的标准公式(请注意,Y,R,G和B都是介于0和1之间的值)。 But your image is probably not in the CIE-RGB space, it is likely in the sRGB color space, so you are in fact just getting a value that exists in no standard defined color space (you are in some sense making up your own space). 但是您的图像可能不在CIE-RGB空间中,而可能在sRGB颜色空间中,因此实际上您只是获得了一个没有标准定义的颜色空间中存在的值(从某种意义上说,您是在弥补自己的空间) )。

This brings us the another important question: I'm interested in knowing the intensity of a given picture's light in the "blue" spectrum, rather than pure luminance. 这给我们带来了另一个重要的问题: 我有兴趣了解给定图片在“蓝色”光谱中的光强度,而不是纯亮度。 makes no sense if you do not define exactly what is, for you, the blue spectrum. 如果您没有准确定义蓝色光谱,则毫无意义。 As @abamert says you already have a _ blue _ value from your RGB image. 正如@abamert所说,您的RGB图像中已经有一个_ blue _值。 That's a blue according to sRGB which uses the D65 white point and has x=0.15 and y=0.06 (in CIE-XYZ space) as the blue primaries. 根据sRGB ,这是蓝色,它使用D65白点,并且x = 0.15和y = 0.06(在CIE-XYZ空间中)作为蓝色原色。 And that's the easier to compute as you just already have it. 而且,这已经很容易计算了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM