0

Please can someone tell me the possible cause when I add an external webcam to this code to run (capture image) it throws exception:

An error occurred while capturing the video image. The video image will now be terminated, Object reference not set to an instance of an Object

Here is the link to the C# code I'm using in my application to capture image from webcam:

http://sites.google.com/site/webcamlibrarydotnet/winfrom-and-csharp-sample-code-and-download

7
  • What line are you getting the error on Commented Nov 14, 2011 at 22:42
  • 2
    Post the code that's failing here. Keep the link, but not everyone is going to be bothered to download that code. Commented Nov 14, 2011 at 22:46
  • Okay here is the codes its preety long. Commented Nov 15, 2011 at 4:29
  • Get out Visual Studio (I know what a hassle) - then press F11 (to start debugging - who would have thought it had a use). Then investigate the line of code that fails - post that here. Also at the bottom of the article the author says: "f you found any problem please report to me by comment at below..." My guess is that the error is actually coming from the WebCam reference, you might have to decompile that DLL using Reflector and Denis Bauer's File Disassambler to be able to debug code inside the WebCam - I'm not sure - this is only a guess. Commented Nov 15, 2011 at 6:10
  • @JeremyThompson, actually it doesnt show the line of code that fails except this " an error ocurred while capturing the video image.The video image will now be terminated, Object reference not set to an instance of an Object".but the application winForm GUI still runs but if i select my laptop in built webcam it functions very well.what could be the problem.how do add webcam reference (usb webcam) to my projects if thats the possible cause. Commented Nov 17, 2011 at 0:08

1 Answer 1

1

Ok, may I suggest the easiest solution to avoid that demo project on google code, even the author admits there might be problems.

Use a different example tha'ts been rated 4.5/5 stars and downloaded 230,000 times: C# Webcam Capture

Sign up to request clarification or add additional context in comments.

2 Comments

the C# Webcam Capture,i does not have image capture to capture images?
@DaveChika it does have image capture to capture images. Thats what happens in the timer1_Tick event, it saves BitMap images... when running the program it can achieve a frame rate around 15 FPS.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.