display live image from an usb PC camera in windows application - c#

I want to display live image from the usb PC webcam using C# windows application in Visual Studio 2010. I have searched about that and find the link http://channel9.msdn.com/coding4fun/articles/Look-at-me-Windows-Image-Acquisition but when i tried this code
WIA.CommonDialog class1 = new WIA.CommonDialog();
Device d = class1.ShowSelectDevice(WiaDeviceType.UnspecifiedDeviceType, true, false);
if (d != null)
{
settings.DeviceID = d.DeviceID;
settings.Save();
}
I am getting the giving compilation error
error CS0103: The name 'settings' does not exist in the current context
And I am not able to find out the solution for this error.
Can anybody body please tell me what would be the solution for this error?
And Is there any other best method to display live images from usb webcam?
Any help would be appreciated....
Thanks in Advance..

It looks as though you haven't defined a settings object, however it doesn't seem to be in the tutorial either. Personally though I would use AForge.NET library as this provides an extremely easy interface to webcams.
http://aforgenet.com/
Tutorial: http://vimeo.com/7526663
Thanks

AForge.NET is very powerful library. But for testing purporse or simple project you could use WIA. Take a look at this tutorial - small example how to start

Related

OCR Exception:Iron OCR InstallationPath Permission Error 1772

I'm trying to use Iron OCR's library for OCR, I came across this error while trying to do the basics.
AutoOcr OCR = new AutoOcr() { ReadBarCodes = false };
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
var Results = OCR.Read(#"Screenshot.png");
Console.WriteLine(Results.Text);
OCR Exception:Iron OCR InstallationPath Permission Error 1772. Could not deploy and run IronOCR resources to path '' for user 'MYPCNAME\MYUSER'. This can be fixed globally by setting IronOcrInstallation.InstallationPath to a directory on disk with file read and write permissions. Please refer to documentation at http://ironsoftware.com/csharp/ocr/docs/html/P_IronOcr_IronOcrInstallation_InstallationPath.htm
This is the full error I get every time I try to run this code. If anyone could give me a hand, I'd appreciate it. Thanks!
That permission message is pretty misleading and wrong for most of the cases, I solved it by installing the c++ runtime (32+64) and it works like a charm!
In my case it was due to using .net core. IronOcr does not support it, use .net framework instead. Unfortunately they didn't bother to document this clearly.
Thanks staind852 for the suggestion on github

Fingerprint scanner futronic FS80 integration with WPF

I am developing a C# program in WPF which scans a fingerprint, stores it somewhere on local disk and then read it in another program for further manipulation.
For fingerprint scanning, i am having futronic device FS80. I have got all the required dlls in the CD but the biggest problem for me is those dlls are not valid COM components so not able to add them as a reference in my project. Anyhow I managed to add them using dllImport through coding but now I dont know which are the functions the dll contains and what are their parameters and use.
Totally stuck at the first phase only. Very frustrating because its my first attemp with wpf and device integration.
Can anyone please guide me how to integrate FS80?
I searched on futronic site but they are only providing sample exe and no code.
If anyone is having any type of idea please share.
I found something helpful.
http://read.pudn.com/downloads110/sourcecode/math/457634/FingerprintDemo/fingerprint/ftr%20scanner/ftrScanAPI.h__.htm
It is not in C# but it will give an idea

Did not find acceptable output video pin in the given source

I'm using AForge Video Source Player to playback a couple movie clips that exist in my local filesystem within a winforms application.
Example of my playback code:
videoSourcePlayer.VideoSource = new AForge.Video.AsyncVideoSource(new FileVideoSource(fileName), true);
videoSourcePlayer.VideoSource.VideoSourceError += VideoSource_VideoSourceError;
videoSourcePlayer.Start();
I found it odd it didn't showed any videos on production machines although it worked on my development machine. I went ahead and found this among the error logs.
This was outputted from the event VideoSourceError.
Did not find acceptable output video pin in the given source
Can someone tell me how do I solve this ?
Thank you.
Answer: Thanks to valter
Maybe you are missing a video filter for your particular video file. Try installing a filter/codec package.

C# Vlc.DotNet Libraries - Null reference exception

Recently stumbled upon this post whilst trying to decide on the best way of getting a VLC player into C#.
Does VLC media player have a C# interface?
I downloaded the dll files and imported them into my project, but then realised I had no real idea of how to use them. Has anyone got a Windows Forms example of this code that works? The code have tried is shown below -
Vlc.DotNet.Core.Medias.MediaBase media = new
Vlc.DotNet.Core.Medias.PathMedia(#"C:\Users\...\SampleVideos\Wildlife.wmv");
Vlc.DotNet.Forms.VlcControl vlcControl1 = new Vlc.DotNet.Forms.VlcControl();
vlcControl1.Play(media);
I am also using the code in this link in the main program.cs of my project.
http://vlcdotnet.codeplex.com/wikipage?title=Forms
The current problem I experience is that upon starting the project it throws a NullReferenceException when it gets to ->
vlcControl1.Play(media)
The problem seems to be with the vlcControl but I am unsure why. The documentation seems to rather thin and I couldn't find any working examples on the codeplex site. If anyone has a working forms example or knows what I might have missed please let me know!
Here is the call stack present when the error occurs ->
RTSPViewer_Test.exe!RTSPViewer_Test.Form1.Form1_Load(object sender,
System.EventArgs e) Line 31 + 0xd bytes C#
RTSPViewer_Test.exe!RTSPViewer_Test.Program.Main() Line 30 + 0x1d bytes C#
When debugging it appears that the Media and Medias attribute of the VLC control are both null. When trying to set the Media of the control to the media object created above a
NullReferenceException
Checking the VLC control object Media does indeed equal null, but I am not sure why it hasn't been initialised properly.
I was unable to get the program to work using the latest version of the Vlc.dotnet libraries but instead used the alpha 2 version which was posted by Raj. I used VLC version 1.1.5 with this library to get the basic example to function properly. My end objective was to stream from an rtsp device, however this library does not appear to support this functionality yet.
For anyone looking to use a good C# wrapper for using VLC then this is a great example -
http://www.codeproject.com/Articles/109639/nVLC
Used the library files from VLC 1.1.1 with this project and works fine. Supports pretty much all the features that you would usually use in VLC but gives you much more control over what you use them for.
Many of the issues that arise when using these DLL wrappers arose from incorrect versions of the source DLL files. The VLC libraries are only 32 bit at this time, so you need to make sure to compile using x86 mode otherwise the libvlc.dll will not load properly and the application will crash. Using the above example you must also make sure that the libvlc.dll, libvlccore.dll and the plugins folder are included in the build folder.

How do you get an iPhone's Device Name in C#

I'm writing a C# winforms application that will transfer files from an iPhone or iTouch using the Manzana library.
My iPhone is called Mark's iPhone and I want this to display in the application. I can't find any simple way of finding this. Can anyone help. Please!
Pardon the vague answer, but I don't have the manzana sources in front of me.
To get the device's name, you need to call the AMDeviceCopyValue() function with the reference you have to the device and the key "DeviceName".
Pseudocode:
AMDeviceCopyValue(device, 0, "DeviceName");
First, go download the iTunes COM SDK. Create a new project and reference the library. I don't know anything about the library you're talking about, but I imagine it's built off of the SDK, so you may already have a reference.
The C# source code snippet below should get you the name of your iPhone. If it doesn't work, try ITSourceKindDevice instead of iPod.
iTunesApp app = new iTunesAppClass();
IITSourceCollection sources = app.Sources;
foreach(IITSource s in sources)
{
if(s.Kind == ITSourceKind.ITSourceKindIPod)
{
Console.WriteLine("Type: " + s.Name);
}

Categories

Resources