title: Insufficient memory to continue the execution of the program" error when run WPF application that uses the RenderTargetBitmap class
body: <p>Currently, Working on project for detect face from Live Video. I had used MS cognitive service face api for detect face and opencvsharp for streaming live video. Now I need to draw a face rectangle on live video screen. For this I had override the frame with draw content(whatever want).
      This is working on some pc while gives error in some another machine although they are same configuration. Can you please suggest what I am wrong there:</p>
  
  <pre><code> private static BitmapSource DrawOverlay(BitmapSource baseImage, Action&lt;DrawingContext, double&gt; drawAction)
      {
          double annotationScale = baseImage.PixelHeight / 320;
  
          DrawingVisual visual = new DrawingVisual();
          DrawingContext drawingContext = visual.RenderOpen();
  
          drawingContext.DrawImage(baseImage, new Rect(0, 0, baseImage.Width, baseImage.Height));
  
          drawAction(drawingContext, annotationScale);
  
          drawingContext.Close();
  
          RenderTargetBitmap outputBitmap = new RenderTargetBitmap(
              baseImage.PixelWidth, baseImage.PixelHeight,
              baseImage.DpiX, baseImage.DpiY, PixelFormats.Pbgra32);
  
          outputBitmap.Render(visual);
  
          return outputBitmap;
      }
  </code></pre>