سؤال

I see that the algorithm for measuring luminance in LUX for a pixel is (obtained from here)

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. 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. A better choice would be 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).

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. You are not getting LUX or Candles or anything precise from a camera image.

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. There are several RGB color spaces.

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). 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).

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. 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. And that's the easier to compute as you just already have it.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top