Ask a questionAsk a question
 

QuestionSlow Freehand Drawing On Video Frame

  • Tuesday, November 03, 2009 3:21 AMtyuan Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I am attempting to make an application, which allows user to do
    freehand drawing on paused video surface.Or using mouse cursor to
    simulate pen or brush movement on video frames. Currently my approcah is
    to grab the paused frame as a bitmap and draw on this bitmap, then paste
    it back to the video window.This method works fine for my Desktop PC, which
    is AMD Athlon 64*2 Dual Core 4200+, 2,20GHz. However, when I tried using 
    a release build on a TabletPC with Centrino Duo 1.83Hz, the drawing speed
    suffers quite a bit.

    I want to find out if there is any better approach to do this type of drawing
    on video surface. Or is there a way to create a transparent video overlay on top of the 
    paused frame and draw on this layer? 
    Thanks.


    Environment:
    Windows XP. windows SDK 6.0, Visual Studio 2008, C++, MFC, GDI+ for graphics
    I also used double buffering for GDI+

All Replies

  • Tuesday, November 03, 2009 7:04 AMRoman RyltsovMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Intercept a click on the window, do SetCapture and draw directly on the window DC until user releases the button. Then duplicate the drawing on the paused frame and paste it back to the graph. Just do not paste video frame on every cough user makes, and you should be okay with the performance.
    http://alax.info/blog/tag/directshow
  • Tuesday, November 03, 2009 3:13 PMtyuan Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks very much for your reply. But I am just wondering how to paste the drawing back to the graph? I am currently using VMR7 in windowless mode. I use GetCurrentImage() to grab the bitmap frame. The reason why I draw the video frame for every cough user makes is because I need to allow user to be able to select the drawings using mouse cursor and move it across the screen. Hence I need to refresh the video display area in order to erase the previous drawings. 
  • Tuesday, November 03, 2009 3:33 PMRoman RyltsovMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    If you are using IVMRMixerBitmap Interface, video is updated with next main video stream frame, not with your alpha overlay update. To "paste" image back to graph you typically need your own filter in the chain to send a new frame to VMR.
    http://alax.info/blog/tag/directshow