Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
523 views
in Technique[技术] by (71.8m points)

.net 4.0 - How to get web cam images in C#?

I'm working on online video conferencing project in C# and .Net4.0.

I want a library or code which I can use for collecting web camera images per second in different form. I try this by using the AVICAP32, in which we send Messages for different purpose like copy or edit frames.but in this we have to pass a reference of picturebox while creating handler as given below:

mCapHwnd = capCreateCaptureWindowA("0", 268435456 | 1073741824, 0, 0, 640, 480,picturebox1.Handle.ToInt32(), 0);

Using these commands I'm able to capture images but the problem comes when I minimize the picturebox form. At that time doesn't create new image.

I think this is happened because I minimize the form and when it copies the image from this clipboard it doesn't show anything.

How can i solve this problem . Any type of help will be appreciated.

Thanks srdusad

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I've done this using all the mentioned techniques (WIA, AviCap & DirectShow). DirectShow is your best option. Check out the free DirectShowNet library which is a .NET wrapper for DirectShow, it even includes samples: http://directshownet.sourceforge.net/

UPDATE 2012-07-26: I've just released the complete sourcecode of my Windows app CamTimer (written in .NET/C#). Download/view the complete code (with working Webcam examples) at https://github.com/johanssonrobotics/CamTimer


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...