I agree with @jandren 100%. But perhaps we can clarify this a bit further by looking at the math.
Before light is detected by the camera/eye, the light source strikes an object and is re-emitted by it. The spectral signal S(λ) that ultimately reaches the eye/sensor is the product of the light source (illuminant) and the re-emission coefficient of the object’s surface:
S ( λ) = I ( λ)⋅R ( λ)
• I(λ): The spectrum of the light source (illuminant); contains the complete physical properties of the light.
• R(λ): The spectral reflectance curve of the object (what percentage of which wavelengths are reflected); contains the complete physical properties of the object we are photographing.
The camera measures this incoming signal S(λ) through its three color-channel filters (red, green, blue). Since the sensor captures all wavelengths simultaneously and sums them up, the result is:
• CR(λ), CG(λ), CB(λ): The camera’s spectral sensitivity functions.
• R, G, B: The final three pure numerical values after demosaicing stored in the RAW pixel.
Ultimately, the eye is also just a sensor and behaves in exactly the same way, except that its spectral sensitivity curves (defined by the CIE as early as 1931, long before digital cameras or computers even existed) are completely different from those of the camera. The same applies here:
• x(λ), y(λ), z(λ): The virtual cone sensitivities of the CIE standard human observer.
• N: A normalization factor
The problem (camera metamerism) is as follows:
There can be exactly two surfaces that, under the same light source, produce identical RGB values for the camera but appear completely different to the human eye (XYZ). To your camera, these two objects are indistinguishable at that moment—it sees one and the same color, while you, as a human, perceive a clear difference in color. This happens particularly often with artificial dyes, textiles (e.g., highlighters or dyed fabrics), and certain car paints. (The same applies, of course, in reverse.)
So if you knew the spectral signal S(λ), you could use it to unambiguously calculate both the RGB values and the XYZ values. However, since a consumer camera (I think I once read that there’s a Hasselblad that actually records the spectral signal directly) can only reconstruct the RGB values, it’s not possible to calculate the spectral signal from them.
That’s why, if you’re mathematically precise, there’s never an exact mapping of camera RGB values to XYZ (or other Rec. 2020) color spaces. Not even—and this, it seems to me, is often overlooked—if you had a profile tailored exactly to the current lighting conditions. It’s not the light source alone that matters, but rather the product of the light source and the re-emission coefficients.
Translated with DeepL.com (free version)