So I am trying to develop a WPF app that will allow me to turn off the auto zoom and auto focus abilities of my webcam. I'm using the Emgu c# wrapper for opencv and want to be able to do frame differencing without my camera auto focusing when an object comes into the screen.
I have tried looking for an sdk that would allow me to develop something like this but apparently logitech ditched theirs a couple of years ago. I am using an HD pro Webcam c920. I have heard that maybe you can use the dll's that shipped with it to tweak the options but I have no idea how to do this.
Any help would be awesome.
Logitech HD Pro Webcam C920's Zoom, Exposure, Focus can be controlled using DirectShow API. Chances are high that Emgu CV is using DirectShow to capture (always, or as an option), or at least you possibly can set the camera up using DirectShow and the settings would survive restart of streaming sessions.
C920's properties are available using IAMCameraControl interface. It is documented on MSDN for native development, and DirectShow.NET offers respective definitions for .NET.
Related
I'm implementing WPF app where I need to take high quality photos from integrated camera. So far I've been successful with capturing video and taking frames from it (described for example here: Wpf and C # capture webcam and network cameras).
But this is not what I want - because video frame quality is not so great. I have MS Surface 4 Pro which has 8Mpx camera with full HD video support and with the above method I'm able to just get full HD frame from it. But I would like to have full 8Mpx picture, like it is possible to take in the native Windows Camera app.
In UWP I would probably have been successful with CameraCaptureUI class, but I didn't find any clues for WPF.
Does anyone has an idea how this could be implemented?
I've found out that XAML Islands do work with .NET Framework 4.8. So I've been able to implement a WPF solution using UWP components MediaCapture and CaptureElement. With that I can take photos with full resolution which was my goal.
Simple sample project can be found here: https://github.com/ondrasvoboda/WPFCamera, consider it just as a proof of concept.
If your app will run on Windows 10 or above, you can now use most of the APIs from Windows 10 in a WPF application.
https://blogs.windows.com/windowsdeveloper/2019/04/30/calling-windows-10-apis-from-a-desktop-application-just-got-easier/
I'm a complete beginner in C#, but I'm trying to write a very simple application in C# (VS2013) to simply view video stream or capture frames from a Sony FCB-EV7500 camera. The camera connects to a small USB3 board using CN401, and the board connects to the laptop via USB3. I can view video in VLC for example, but i'd like to write code in a C# application to get video/grab frames.
Google searching this brought me to DirectShow which apparently is only a C++ library. There used to be a DirectShow.NET wrapper available here: http://directshownet.sourceforge.net/about.html but it seems they haven't updated the project since 2010 and a lot of functions/interfaces at that time remained untested.
Are there any commonly used libraries for accomplishing this in C#? Perhaps something included in the .NET framework? Thanks for any advice or direction.
You really don't want to be marshaling full frame rate video into a C# application.
You should probably take a look at the .net bindings for gstreamer, I have personally only used the C and python bindings so YMMV. If that doesn't work you will need to:
Use direct show, gstreamer, or ffmpeg to deal with media.
Write a native wrapper around your media handling code.
Write C# code to interop with your wrapper.
depending on if you are using winforms or wpf you will either use a NativeWindow or D3DImageSource as your render target.
I have created a project using directShow that takes the captured video from a webcam and preview it.
Now I want to encode on run time video captured alive and save it on desk then play it back I want to use it as part from my code(dll for example) not a standalone part.
Any links can help me to get how to do that please I am in search process for a week and feel not understood with the methodology?
If you're writting new app, or you're interested in learn about video processing you should consider using Microsoft Media Foundation.
DirectShow is an 'obsolete' and shortly will be discontinued technology.
If despite this, you're still interested in DirectShow, you could start with MSDN DirectShow Documentation (Examples are in C++ but the idea is the same).
As short summary you must understand this concepts.
What is a DirectShow Filter, and wich types exists (Source,Transform,Renderers and Capture).Introduction to DirectShow
How can I connect multiple Filters in a Graph,how filters are connected between them, and how I can control the playback. Start with Building the Filter Graph.
Some utils that can help you:
DirectShow Graph Spy DLL Allows to watch Graphs created by others app
Monogram Graph Studio Improved version of Microsoft Graph Edit.
NOTE: As you tagged this post with 'C#' and 'Directshow.NET' tags, I will consider that you're using DirectShow.NET library (the unofficial port of DirectShow to .NET).
I'm trying to implement camera security in my application. I got some SDK's from some security companys to implement there system but they all use ActiveX. My view right now is that ActiveX is kinda old?
But what is the newest way to get video from devices and display (stream) them on a screen?
What control to use in .net 4.5 WPF (and Windows 8)
I'm working on video WPF app for two years now and we had a fundamental problem with video and WPF which was never resolved, and that's variable fps-rate. This blog post goes into details.
There's also a nice library called Media Kit (by Jeremiah Morrill), it might be suitable for your problem.
In our solution we had no choice but to expose HWND's for our rendering DirectX engine. We accomplished this by using HwndHost class and extending it to our custom WPF control. Note this is the base class for windows forms host, so you get the same amount of problems as with WinForms-WPF inter op.
Also, ActiveX is the only way to display professional camera video streams in web interfaces, it's still a defacto industry standard, you'll get it from MOXA, Acti, Vivotek and various other camera equipment manufactureres.
One more thing, if you need to perform some advanced analysis of video, I'd suggest OpenCV.
I want to put a news marquee over an analog TV stream using c#, I can stream analog TV using DirectShow but I can't figure out how to mix it with rotating text, should I create a filter? or I have to use another technology than DirectShow?
DirectShow is the simplest way of doing this but it does have a bit of a learning curve, particularly coming from C#. The Wikipedia page gives you a basic overview of DirectShow.
DirectShow tools are available in the latest Windows SDK. Using C++ for DirectShow programming is more straightforward but you can use DirectShow fairly easily via COM interop or DirectShow.net (which I haven't tried yet). If using COM interop the following article is helpful:
http://blogs.msdn.com/b/ericgu/archive/2004/09/20/232027.aspx
You may be able to use the VMR overlay filter if the animation performance is smooth enough. See the following articles
http://www.codeproject.com/KB/audio-video/VideoPicture.aspx
http://www.codeproject.com/KB/audio-video/Ticker.aspx
http://msdn.microsoft.com/en-us/library/dd407344(v=vs.85).aspx
Alternatively you will need to write your own filter that renders the text on each frame adjusting its position in synch with the time stamps of the video frames. If you only need to do this inside your own application then the following approach might be easiest
http://www.sichbo.ca/Free_Code/100_C_Sharp_directshow_filters
Microsoft officially recommend that DirectShow filters should be created in C++ for performance reasons but overlaying scrolling text should be OK in C# as the bottleneck will be the APIs used to overlay the text if you program carefully.
Actually you don't have to write a filter to draw some text over your video. Just make a graph where uncompressed video goes through sample grabber (one of standard DirectShow filters), set up a callback for the sample grabber and you'll be able to modify the video data in your callback. Doing it in C# is very easy using DirectShow.NET but not optimal due to marshalling. You can first build such a graph in GraphEditPlus, then it will show you source code in C# or C++ of how to build this graph and use sample grabber.