title: Finding origins of mixed color as wavelength
body: <p>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?<br>
  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.<br>
  Aside from converting RGB, another solution may be generating full spectra as rainbow and comparing RGB to spectra. Is that possible?<br>
  Question summary (let me make it clear for downvoters):</p>
  
  <ol>
  <li>How to guess not only dominant color in RGB but also try to guess some composite values (eg. for magenta)?</li>
  <li>How to generate rainbow so I can use it to compare it with RGB?</li>
  </ol>
  
  <p>And for those who demand sourcecode example, I am looking for function:</p>
  
  <pre><code>int rgb2wave(int r, int g, int b) {
      /*some code*/
      return wavelength;
  }
  </code></pre>