title: Very Slow Processing of my Opencv Application
body: <p>I am building an OpenCV application which captures a video from camera and overlays it on another video after removing the background. </p>
  
  <p>I am not able to achieve a reasonable speed as it is playing the output at about 1 fps, whereas my background removal is working at 3fps.</p>
  
  <p>Is there a way to display the background video at its normal speed and overlay the processed video at 3fps ?</p>
  
  <p>I tried commenting out my code and I realized that the problem lies majorly with the Rendering part itself. I tried displaying the video along with my web cam feed and I noticed that there is a drop in the actual fps and the fps of video when displayed with openCV.</p>
  
  <p>here is the sample code:</p>
  
  <pre><code> void main()
  {
      CvCapture* capture, *Vcap;
      capture = cvCaptureFromCAM(0);
      if(!capture)
      {
          printf("Video Load Error");
      }
  
      Vcap = cvCaptureFromAVI("bgDemo.mp4");
      //printf("\nEntered BGR");
      if(!Vcap)
      {
          printf("Video Load Error");
      }
  
      while(1)
      {
  
          IplImage* src = cvQueryFrame(Vcap);
          if(!src)
          {
              Vcap = cvCaptureFromAVI("bgDemo.mp4");
              continue;
          }
          IplImage* bck1 = cvCreateImage(cvGetSize(src),8,3);
          cvResize(src,bck1,CV_INTER_LINEAR);
  
          cvShowImage("BCK",bck1);
          cvWaitKey(1);
      }
  }
  </code></pre>