Click here to Skip to main content
Click here to Skip to main content

DirectX Video Stream and frame capture

By , 12 Jul 2004
 

Introduction

There is a tremendous job done by NET master and enhanced by Brian Low. However, I was needed a library that can continuously capture image/bitmap from the video source and record it at the same time. Then I saw the Net master's project and Brian low's project. Well, they have done a great job, but the feature was not included in the project. So I decided to add one. By the way, I saw another project that did the same function, but it was not continuously capturing the frame by triggering event, and the video capture is rather slow, it cannot produce a smooth stream. And the frame per second is rather slow too. However, it was a great effort.

Background

Actually I was just combining the samples together. So, it could be best for you all to refer back to the samples.

Using the code

Just add a button for triggering the event and the GrapImg method. Then, add another handler of the event, which I add is the CaptureDone handler.

The CaptureDone will be fired once a frame was copied from the image buffer. After that, just display the bitmap into a picture box.

private void button1_Click(object sender, System.EventArgs e)
{
    capture.FrameEvent2 += new Capture.HeFrame(CaptureDone);
    capture.GrapImg();
}

private void CaptureDone(System.Drawing.Bitmap e)
{
    this.pictureBox.Image=e;
}

However, for it to work, you will have to know how to use the DirectX capture library at first. because you will have to setup the properties for a video capture to be started, and you will need to start previewing the video before the CaptureDone will be fired.

Points of Interest

Well, one thing is, it took me a lot of time reading through NET master's and Brian Low's code. Any comment, you are welcome..... thanks. Below are two links to the Brian Low's class library and NET Master's DirectShow.NET. (Thanks for the suggestion)

History

None.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

hpAng
Web Developer
Malaysia Malaysia
Member
Please visit my website www.mbwebcreator.com for more web site information.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
Questionhellomemberyoushy1 Apr '13 - 5:11 
do u know how can i add calculator fps what the code for it?
QuestionAudio Record CallBackmemberMihaescu Florin3 Oct '12 - 22:29 
I saw that image frame is given to us in BufferCB callback.But how to record audio and at every 200 ms of audio and image to send them through network?
GeneralMy vote of 1memberMember 87853324 Jul '12 - 2:44 
worst content in this world
GeneralMy vote of 5memberadeeb masoud6 Mar '12 - 17:11 
Thank you very much for such a great work
Questionhow to take image by dirctx in c#membermorteza fakoor4 Dec '11 - 8:55 
hi Mr.hpAng
i am Morteza
i wanna take image by DirectX in C#.
i'd be very grateful, if you can help me.
best regards
Morteza Fakoorrad
GeneralMy vote of 5membersor@t5 Jul '11 - 1:43 
This topic is very useful
QuestionHow to execute the filememberprashantwamane1 Dec '10 - 18:38 
How to execute the file
GeneralMy vote of 4memberaofeng322 Nov '10 - 19:03 
thanks you are very good
Rantawesome!!!memberMember 36942812 Nov '10 - 9:50 
Excellent. Great project.Thumbs Up | :thumbsup:
Generalhelp!memberdeching10 Nov '10 - 5:18 
i need just one image .jpg when i click on the button (left side name: bttuon1)
i dont want callback becasue it saving one frame every second.
 
public void GrapImg()
 
i want one picture frame .jpg when i click on button.
 
can u help me thanks!!!
 
nicola

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130523.1 | Last Updated 13 Jul 2004
Article Copyright 2004 by hpAng
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid