So I am trying to turn my webcam to a simple spectrometer. Because whole process is behind not only camera chip, but also the framework that gets the values I have to work with RGB. This makes me ask myself a question: can I guess the major wavelengths each light consists from?
There will be a piece of CD, or a crystal to break the light beam to pieces, before it reaches the camera, but still I need some self-calibration. And also, I like nice graphs.
Aside from converting RGB, another solution may be generating full spectra as rainbow and comparing RGB to spectra. Is that possible?
Question summary (let me make it clear for downvoters):
- How to guess not only dominant color in RGB but also try to guess some composite values (eg. for magenta)?
- How to generate rainbow so I can use it to compare it with RGB?
And for those who demand sourcecode example, I am looking for function:
int rgb2wave(int r, int g, int b) {
/*some code*/
return wavelength;
}