Filter löschen
Filter löschen

How to express color in terms of wavelength.

23 Ansichten (letzte 30 Tage)
正義 金田
正義 金田 am 26 Jun. 2023
Beantwortet: Image Analyst am 27 Jun. 2023
When extracting color data from image data, I want to extract the data as wavelength, not in RGB or LAB format.
For example, if the color of the image data is red, it is 700nm, and if it is blue, it is 450nm.
  3 Kommentare
Stephen23
Stephen23 am 26 Jun. 2023
Bearbeitet: Stephen23 am 26 Jun. 2023
"When extracting color data from image data, I want to extract the data as wavelength, not in RGB or LAB format."
In general this is not possible: there are infinite combinations of wavelengths that can combine to produce the same color:
DGM
DGM am 26 Jun. 2023
Consider a pixel with value [255 255 255] in the center of this image.
Is that a uniform SPD across all visible wavelengths, or is that a combination of three discrete spectra corresponding to some arbitrarily chosen values for red, green, and blue? What if I told you that it wasn't even in the visible spectrum, but was instead actually a narrow peak at 850nm?
The act of projecting the SPD through an unknown, wavelength-dependent system and integrating the result is an irreversible reduction of information. A camera is not a spectrometer, though you could make a spectrometer out of a camera. Note that in order for those photographs to represent the whole SPD, they actually need a relatively large RGB image to represent a single sample point. That entire rainbow image represents one pixel.

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Anamika
Anamika am 27 Jun. 2023
To express color in terms of wavelength, you can use the concept of the electromagnetic spectrum. The visible spectrum ranges from approximately 400 nanometers (nm) to 700 nm, with shorter wavelengths corresponding to colors like blue and longer wavelengths corresponding to colors like red, here are some ways to convert colors to their corresponding wavelengths:
1)First, determine the color space of the image data you are working with if you have RGB values, convert them to the corresponding color space, such as CIE XYZ or CIE LAB
2)Once you have the color values in a suitable color space, you can map them to the visible spectrum. The exact mapping depends on the specific color space and the range of wavelengths you want to work with.
3)e.g in the CIE XYZ color space, you can use the CIE 1931 Standard Observer functions to calculate the tristimulus values for a given color.
4)To convert the tristimulus values to wavelength, you can use interpolation techniques.
5)Always remember while doing that this conversion is an approximation, as it assumes a linear relationship between color and wavelength. In reality, the perception of color is more complex
Hope it will help you
~Thanks
  1 Kommentar
DGM
DGM am 27 Jun. 2023
Bearbeitet: DGM am 27 Jun. 2023
You have a luminous object or a point on an illuminated surface. The light projected onto the camera's sensor from that point has a spectral power distribution that looks like this:
Your camera's sensor has a response curve that looks like the solid black line:
... but all the light that reaches the sensor passes through a combination of an IR filter and a color filter screen with the indicated response curves. Ignoring demosaicing and all in-camera processing (which we can assume are completely unknown anyway), the values of a given pixels elements are the integrals of the products of the source SPD, sensor response, and the respective filter responses. @Stephen23's comment about nonuniqueness should seem quite obvious now.
For sake of a simplified example, given the weighted sum Y = k1*X1 + k2*X2, can you find a unique numeric solution for X1,X2 if Y is known? What if k1,k2 are only approximately known? Could you even be certain if X1>X2?
So given an RGB tuple, show me how you would back-calculate an SPD and reduce it to a single representative wavelength -- all without knowledge of any of the above intormation. Again, feel free to use the prior example. Say our given tuple is [255 255 255] in sRGB. What is the wavelength represented by a white pixel?

Melden Sie sich an, um zu kommentieren.


Image Analyst
Image Analyst am 27 Jun. 2023
If you need a spectral image, then don't collect an RGB image. Collect an image with more wavelengths in the first place. You need an imaging spectrometer, https://en.wikipedia.org/wiki/Imaging_spectrometer , or hyperspectral camera. There are portable and desktop instruments available.

Produkte


Version

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by