title: Efficient Background subtraction with OpenCV
body: <p>I want to do background subtraction in a video file using OpenCV method. Right now I'm able to do background subtraction, but the problem is that I couldn't get the output in color mode. All the output after subtracting the background is coming in grayscale color mode <strong>:(</strong>. I want to get the color information to the foreground which is the resulting output after background got subtracted. </p>
  
  <p>Can I do it using masking technique?? like the following procedure which I'm thinking about.</p>
  
  <ol>
  <li>Capture Input  -- <code>InputFrame</code> (RGB)</li>
  <li>Process <code>InputFrame</code></li>
  <li>Subtract background, store foreground in <code>TempFrame</code> (which is coming in grayscale <strong>:(</strong> )</li>
  <li>Create a mask using <code>TempFrame</code></li>
  <li>Apply the created mask to the <code>InputFrame</code></li>
  <li>Get colored foreground as <code>OutFrame</code></li>
  </ol>
  
  <p>I'm struck up with doing the masking using OpenCV. I'm just a very beginner in OpenCV. Please help me to overcome this.</p>
  
  <p>Thanks in advance.</p>