Groups | Blog | Home
all groups > dotnet general > june 2004 >

dotnet general : video capture in Visual C# .NET


Ravi
6/19/2004 11:56:01 PM
Hi,
Im trying to develop a Visual C# .NET app. that uses DirectShow filters to capture video from camera source. However, after going through a series of articles, I've seen that DirectShow is not directly supported in Visual C#.NET.

Im wondering if there's any way to use the video-capture filters of DirectShow in Visual C#.

Otherwise, would it be possible to create a Visual C++ DLL that uses DirectShow filters to capture video from a WDM camera source, and use it in Visual C# .NET program.

Please suggest.
Ravi
6/20/2004 6:38:01 AM

Thank you John. That link is quite useful. Thanks a lot for suggesting the correction to that code too..

[quoted text, click to view]
John Young
6/20/2004 12:51:04 PM
Try this

http://www.codeproject.com/dotnet/wiascriptingdotnet.asp

I worked for me, although make sure you read the comments at the bottom of
the page, because there was a bug in the source code. I've put the post
about the bug here to save you the trouble....

HTH, John

Correction to sample code DavidDavison 4:20 2 Nov '03

I suggest a correction to the NetMaster's code.

foreach( object wiaObj in wiaDevs )
{
devInfo = (DeviceInfoClass)
Marshal.CreateWrapperOfType( wiaObj, typeof(DeviceInfoClass) );

//Marshal.ReleaseComObject( wiaObj ); <- MOVE THIS

if( devInfo.Type.IndexOf( "Video" ) > 0 )
{
foundID = devInfo.Id;
foundCount++;
}

Marshal.ReleaseComObject( wiaObj ); // <- TO HERE

Marshal.ReleaseComObject( devInfo ); devInfo = null;
}

I have found that the devInfo you have just
marshalled is released before you can use it to check the type.

Other than that, Nice one NetMaster!






[quoted text, click to view]


begin 666 userinfo.gif
M1TE&.#EA#@`/`+,``/___^3FU,S,F:RJE)F99GQ^? "9_S-F_V9F`#,`S"0B
M) ``_P```````````````"'Y! 44````+ `````.``\```13$$B)*IH85"$(
MJ1G">96",)A(!JR"4EW%!H*2"H@R!X<](1\=BU/[?7(TP<"5^B0'RXQ&IQP4
??!F=8HO%' Z!J!1P,!@2Z(2T_/TN%FH,8TZO3R(`.P``
`
end

begin 666 news_none.gif
M1TE&.#EA# `0`+,`````````@( ``/\``, `P/__`(" @,# P/___P``````
M`````````````````````"'Y! $```0`+ `````,`! ```0/D,A)J[TXZ\V[
(_V HCE($`#L`
`
end

begin 666 smiley_wink.gif
M1TE&.#EA$ `0`-4``````!X6""X?"#HF`DHR`DXZ%EHZ`DY*/F%)'VI*$FU0
M'G9.`G92$F=6-VYA2W5K7H!5!X9:!I)?!89B&HIJ-J)J`JYU"JIV'(!X98A_
M;<)Z`J:"0JJ:=LF%"-:*`MZ/`L*.-L:2.M*6*NR9`NZB&NZJ-NZN,LR<1MFI
M4LJJ=N:R7O*V2O*_9.K">O7*>IB4C*6AG*ZJIK"NK+:VLKZ^NMJZ@MK"EMK*
MJO;2DOK>KLK*QOKFPOKQW?[V[O___P```"'_"TY%5%-#05!%,BXP`P$````A
M^00%?0```"P`````$ `0```&N$" <*BCT73#Y!"&:2 0#4Q,*<P@(!<4R@)!
M8)28!(C'V^5PK$[B*WPI3KWRV<5:=10OH4-"/G!P+AL%)B02#@`Q;V49*70A
M$R0C=S(O#"TW-H!UA!\:'PPOE2T/#G0K)9$5`R.@, PH-0$J*X0C(P01'@HP
M- T6+A0"(I$?!@(C%@TT`!@0)2L7`@(#`0NV$&PS#1(DD;;?$@TS2PT1'=^2
M$0TP2C(.5Q(270XR5$(R&0\/&5-)00``(?D$!3(````L" `%``4``@``!@I
MP&\(R)A,`$(0`#LA^00%,@`_`"P(``4`!0`"```(#0!=`!A((H,)$R0(! 0`
M(?Y 2F%M:64@1'5R<F%N=" M($QI;VYH96%D(%-T=61I;W,@3'1D#0IW=W<N
8;&EO;FAE860N8V\N=6L!55-34$--5 `[
`
end
Ravi
6/24/2004 11:34:01 AM
Hey John,
I was trying to use the WIA Device class for video capture, and the correction that you've suggested saved me time. Thank you.

However, the program is not able to detect my Creative Lab webcam and one other USB 2.0 webcam as WIA devices. Its able to detec a hp scanner as a source for images, but, not the webcams.

Is this a limitation of the WIA script, or am I doing something wrong here?

Thanks in advance.
Ravi.

[quoted text, click to view]
John Young
6/24/2004 10:45:04 PM
I honestly could not say because I am a complete beginner to WIA as well.
I do remember somewhere that some camera drivers dont seem to work with WIA.
The only other way would be to use TWAIN, which is on the CodeProject site
as well. Although I haven't tried TWAIN yet.

Good luck, and let the group know how you get on...

HTH

John

[quoted text, click to view]

ChainsawDude
9/30/2004 10:33:03 AM
John,

I was wondering if you tried to use this code in a batch program? The
supplied code requires a user to be present to click the capture button, I
want to put something on a schedule and run unattended.

Thanks

[quoted text, click to view]
AddThis Social Bookmark Button