title: how to develop background removal using chroma keying in opencv
body: <p>I need to develop an algorithm to remove a background from the foreground image. I would like to use chroma keying. This will be done on a live camera stream and I need to do it using OpenCV in C++.</p>
  
  <p>The algorithm I thought would be something like:</p>
  
  <ol>
  <li>Capture frame from webcam into matrix</li>
  <li>Compute 3d rgb space graph</li>
  <li>The points around a certain value e.g. (10,255,10) for green background.</li>
  <li>Convert all points around green region to 0.</li>
  <li>And the rest to 1.</li>
  <li>Multiply that with the original image (convolution)</li>
  <li>Should get rid of background.</li>
  </ol>
  
  <p>I would like some help on a method to remove a plain color background from foreground image without the color from the foreground image being removed.<br>
  Is there like a special type of crop function to remove background?</p>