Click here to Skip to main content
6,595,854 members and growing! (17,715 online)
Email Password   helpLost your password?
Multimedia » DirectX » General     Intermediate

DirectX Video Stream and frame capture

By hpAng

A library that can capture video stream and frame together
C#, Windows, .NET 1.0, .NET 1.1, DirectX, VS.NET2003, Dev
Posted:5 Jul 2004
Updated:12 Jul 2004
Views:232,609
Bookmarked:86 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
20 votes for this article.
Popularity: 4.70 Rating: 3.61 out of 5
3 votes, 15.0%
1
1 vote, 5.0%
2
1 vote, 5.0%
3
3 votes, 15.0%
4
12 votes, 60.0%
5

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


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

Other popular DirectX articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 25 of 93 (Total in Forum: 93) (Refresh)FirstPrevNext
QuestionError HRESULT E_FAIL has been returned from a call to a COM component. PinmemberHussien.fahmy1:42 7 Nov '09  
GeneralVery nice work! PinmemberLomis0:28 22 Jul '09  
Generali want text watermark over vedio PinmemberBabita Shivade5:02 9 May '09  
Questionmaking snapshot without preview function Pinmemberkatran.ek4:04 3 Mar '09  
General^.^ Thanks........ PinmemberChoon kiat17:00 18 Feb '09  
GeneralCapture several images with GrapImg Pinmember6F2121:49 20 Jan '09  
GeneralRe: Capture several images with GrapImg Pinmemberkumi_aberer@hotmail.com13:39 10 Mar '09  
Generalcan not download the source code? Pinmemberbluewater020917:14 28 Nov '08  
QuestionA dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A) Pinmembersaravanan.rex@gmail.com1:12 21 Nov '08  
AnswerRe: A dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A) Pinmemberdonperry7:49 12 Feb '09  
GeneralRe: A dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A) Pinmemberkostiak210:30 6 Jul '09  
GeneralError HRESULT E_FAIL has been returned from a call to a COM component. PinmemberAnkita Garg2:15 20 Nov '08  
GeneralStart() causes crash PinmemberMember 32046109:30 14 Oct '08  
GeneralStill unable to grab an image [modified] PinmemberChiWaiLam1:19 17 Sep '08  
QuestionVC++ version of DirectXCapture PinmemberWilson Kopman14:39 16 Sep '08  
GeneralColor Control Pinmemberrenoreballos5:07 4 Jan '08  
GeneralDetect webcam PinmemberEddiema9:31 26 Dec '07  
QuestionDirectShow as Web Applictaion Pinmembermenaka.ca14:33 19 Nov '07  
QuestionHelp, Code doesn't run (DShowNET could not be found) Pinmembersmitti1235:17 26 Oct '07  
Generalcan managed C++ use this DLL? Pinmemberrayher4:47 20 Oct '07  
GeneralInterlacing in fast motion Pinmemberbrs0266:56 4 Aug '07  
GeneralHelp PinmemberNelsonPaz14:14 26 Jul '07  
QuestionI face aproblem in changing the video source Pinmemberaishar12:04 18 Jun '07  
AnswerRe: I face aproblem in changing the video source PinmemberRaghu_Super0:20 25 Sep '07  
QuestionCapture a frame without preview PinmemberRodrigoZaratin11:28 12 Jun '07  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 12 Jul 2004
Editor: Nishant Sivakumar
Copyright 2004 by hpAng
Everything else Copyright © CodeProject, 1999-2009
Web20 | Advertise on the Code Project