Click here to Skip to main content
15,886,067 members
Please Sign up or sign in to vote.
2.00/5 (3 votes)
See more:
i want to capture the image but i am getting the error says:-The type or namespace name 'WebcamEventArgs' could not be found(are you missing an assembly reference?)
The type or namespace name 'WebCam_Capture' could not be found(are you missing an assembly reference?)


C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;
using System.Runtime.InteropServices;
using webcam_capture;

namespace CSharpWebCam
{
    class WebCam
    {
       
        private  WebCamCapture webcam;
        private System.Windows.Forms.PictureBox _FrameImage;
        private int FrameNumber = 30;
        public void InitializeWebCam(ref System.Windows.Forms.PictureBox ImageControl)
        {
            webcam = new WebCamCapture();
            webcam.FrameNumber = ((ulong)(0ul));
            webcam.TimeToCapture_milliseconds = FrameNumber;
            webcam.ImageCaptured += new WebCamCapture.WebCamEventHandler(webcam_ImageCaptured);
            _FrameImage = ImageControl;
        }

        void webcam_ImageCaptured(object source,WebCam_Capture.WebcamEventArgs e)
        {
            _FrameImage.Image = e.WebCamImage;
        }

        public void Start()
        {
            webcam.TimeToCapture_milliseconds = FrameNumber;
            webcam.Start(0);
        }

        public void Stop()
        {
            webcam.Stop();
        }

        public void Continue()
        {
            // change the capture time frame
            webcam.TimeToCapture_milliseconds = FrameNumber;

            // resume the video capture from the stop
            webcam.Start(this.webcam.FrameNumber);
        }

        public void ResolutionSetting()
        {
            webcam.Config();
        }

        public void AdvanceSetting()
        {
            webcam.Config2();
        }


        internal void InitializeWebCam(System.Windows.Forms.PictureBox imgCam)
        {
            throw new NotImplementedException();
        }
    }
}


[edit]Code block added - OriginalGriff[/edit]
Posted
Updated 28-Jan-13 21:42pm
v2
Comments
Sergey Alexandrovich Kryukov 29-Jan-13 3:43am    
Why are you re-posting? I warned you 3 times.
I'm serious: it can lead to banning of your account.
—SA

Validate if you correctly referenced assembly in your solution file.
Most likely it resides in some dll file like WebCam_Capture.dll


Here are the steps:
http://msdn.microsoft.com/en-us/library/wkze6zky(v=vs.80).aspx[^]
 
Share this answer
 
Assuming you have added the reference to the web cameras DLL file...
Take out the line:
C#
using webcam_capture;


Then compile your program - you will get errors.
GO to the first error and put the cursor in the first word that is underlined in red. A small blue box will appear at the beginning of the word. Hover the mouse over the box, and a dropdown will appear. Open the drop down, and it will have possible solutions to the problem. The first one should be "using ..." select it and it will add the using statement for you. Repeat this until your references are correct.
 
Share this answer
 
Hi,

you need to go to
https://sites.google.com/site/webcamlibrarydotnet/winfrom-and-csharp-sample-code-and-download[^]

and download DLLforAddReference.zip, extract the WebCam_Capture.dll to your project directory
and add this dll to your References.

And change using webcam_capture; to using WebCam_Capture;

Then it should work.

Regards,

Thomas.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900