I am writing a C# Windows Form application which communicates with a webcam.
However, I want to tune webcam properties inside a button click function. Examples of those properties are brightness, saturation and sharpness.
I have found IAMVideoProcAmp::Set which might aid me with this. However, I don't quite understand how to implement this.
Can anyone help me in the right direction?
What you'll need to do is wrap calls to certain APIs (whether it's Windows, DirectX, etc) which is easier said than done when it comes to C#.
Luckily this problem has been solved numerous times (as you can see by number of webcam questions here) - and you can find one good approach in the following article:
Versatile WebCam C# library
Check out "How to change contrast and saturation programmatically?"
Related
How do you put a Windows Form Application on top off everything on your screen?
Just setting the topmost-property isn't enough when you're running fullscreen games.
If anyone has a solution for good old Forms i'll also be happy
I've seen many posts on this forum that say it's impossible but i know it's not couse i've seen alot of apps (fraps, teamspeak overlay, xfire, etc) that does this.
If you want to use a graphics library to display something always on screen, you may want to start here on SO. There are wrapper libraries available like OpenTK for OpenGL. If you want to go the DirectX route you'll need to load in the C++ libraries and access them using P/Invoke. There's a good tutorial to start with on msdn. Wrappers for DirectX also exist in the form of SharpDX.
I'm currently working at a application that helps people understand how to do there job. You can see it as a personal coach that guides them trough all the steps they need to do that no normal person could keep remembering.
In my previous application we had the ability to show the user up to 4 pictures (what proves to be more then enough). The application would load the data and see how many pictures where in every instruction and then sort out the picture in the best fitting way without messing up the scale and resolution of the pictures. This all was done with GDI+ and worked very well.
Ofc, change is something that always happens, my bosses came up with some great ideas. So they want to be able to see movies on the screen, animated gif's, 3D models that can rotate or animate. So I think we had pushed GDI+ to it's limits and it's time to look for something different.
I have heard and readed about WPF but have no experience with it. Is it even possible to do all what I ask in WPF? And what about the old picture-merging thing I wrote, can we also get it done in wpf? I tried to make some things working but I didn't went as smooth as I hoped.
I'm also concerned about the fact that the interface needs to be dynamic, the one moment it should be showing picture with some text above it, the other moment it should be showing another text with a video under it.
I would love to hear some opinions here and if you got some other suggestions I should look into pls tell me. Thnx in advance
PS: If WPF is the choice, should I convince my boss to change to .net 4.0?
Although my answer can be termed subjective, I find WPF better than GDI+ anyday. You can do everything you can in WPF which you have done/could do in GDI+ (apart from pure games/game engines). If you can afford the steep learning curve of WPF, I think it will be better investment as this technology is not going anywhere soon.
As for .Net 4.0, WPF 4.0 does introduces some important functions in 4.0 (specially easing functions for animations) but there is nothing you cannot do without if you are using 3.5. I won't recommend 3.0 though mainly because of performance in animations.
WPF is up to the task, but you could also check other options.
You could go web based, and have either an XBAP (WPF in the browser), or Silverlight/Flash app.
Silverlight/Flash doesn't require that much from the client (to install), and is easily updatable, and both can do the job.
OK, I know there are quite a few posts on this topic. However, none of them provide the solution to my issue: I don't want just to turn off my monitor(s), I wish my code to turn off a specific monitor. The URL the most people refer to, http://fci-h.blogspot.com/2007/03/turn-off-your-monitor-via-code-c.html, doesn't help here, as it turns off all the displays.
So, I have my laptop screen and an additional external monitor. While I'm watching movies, I switch the display to the external monitor and my laptop screen goes black, however, it's still on and glowing in the dark. I wish to turn it off. Could anyone help please?
EDIT: Is there any way to acomplish this, meaning it needn't have to be written in .Net. Basically, I just need an .exe file that's able to turn the particular monitor off and on alternately.
It looks like there's no good way of turning off a specific monitor, but it is possible to set your laptop's backlight to minimum brightness. Depending on which version of Windows you have, there are different ways to do it:
send IOCTL_VIDEO_SET_DISPLAY_BRIGHTNESS I/O control as described here: http://msdn.microsoft.com/en-us/magazine/dvdarchive/cc163415.aspx
use WMI method WmiSetBrightness as described here: What API call would I use to change brightness of laptop (.NET)?
use Win API SetMonitorBrightness, but I don't know of anybody who has done it in C#.
I am pretty new to DirectShow and really just feeling my way round at the moment. I am wanting to host the directshow renderer window of a directshow graph within a WPF app and am currently using the HwndHost class to try to achieve this. What I need though for HwndHost is a handle to the window which is rendering the video. I have found an example which shows getting the handle by enumerating the pins of an IVideoWindow interface and querying for IOverlay so the GetWindowHandle method can be used to get the handle.
Problem is IOverlay doesnt seem to be available in DirectShow.Net. Reading the DirectShow.Net About page, IOverlay is listed in the table with the heading "These interfaces are in the source code, but are deprecated, undocumented, intended for Ole Automation or otherwise untestable which means they are not, and will not be tested".
So what is it that I have to do to get access to this definition? Is it excluded from the build that is distributed as a library and so should I build the library from source myself?
OR Is there a better way of doing what I am trying to do? Anyhelp would be appreciated as like I said I am new to all this stuff.
Thanks in advance.
EDIT: Not many DirectShow devs out there? Or is this a stupid question, definitely open to any advice peeps may have...
The normal way to do this is to reparent the video window using IVideoWindow::put_Owner to make it a child of your own window. You will also want to set the AutoShow (false), Visible, Width and Height properties, and change the WindowStyle property to make it a child window.
The IOverlay interface was implemented in the first version of DirectShow (1996) to support some hardware decoders that are long since defunct. I don't think the current video renderers will support it.
The window handle was made difficult to obtain because poor application programming caused frequent deadlocks in Video for Windows and the developers felt that a clear separation was needed between the DirectShow threads and the windows they owned, and any application threads.
G
My webcam has a button, with which you take a photo of current frame
when using it's original software what came with it when I bought it.
Is there any way to use that button to take photos in my program.
I would be using C#.
I was thinking of using Windows Image Acquisition (WIA) or avicap32
for using webcam in my software.
Any help would be appreciated. Where do I start?
EDIT:
I see that you didn't understand me. I need to know if my phisycal camera button is pressed.
I am using DigiMicro 1.3 camera (Manufacturer is DNT), which isn't really a webcam but a USB microscope, but
it behaves like a webcam.
Does the camera actually require that the software be running when you press the button? I know some webcams implement this feature at the driver level. If that's the case, I don't think there's much you can do without interacting directly with the USB port, which would be incredibly difficult and likely not worth the trouble. I can't find any technical documentation on the vendor's website with that kind of information.
The "MicroCapture" software doesn't come with any DLLs that have exported functions, so P/Invoking doesn't appear to be an option. Unfortunately, I can't get the driver installed, so I can't check if it comes with any P/Invoke-able DLLs.
Sorry, but since there's no standard interface for that kind of functionality and the vendor doesn't provide any specific information on it, I don't think this is possible. I would suggest contacting DNT directly about it. They may have some component that will do what you need.
This Coding4Fun post guides you through pretty much everything you need to do to get started using WIA, including adding the reference to a project, displaying the select a device dialog, and of course actually taking the picture :P.
Coding4Fun - Look at me! Windows Image Acquisition
I suggest that you take a look at the DirectShow.NET library. It has great functionality for capturing images/videos off connected devices. It also comes with several samples to get you started quickly.