How I capture video from an IP camera using emgucv

Please someone can access to a ip camera with emgucv in c# visual studio in other post share the code

capture = new Emgu.CV.CvInvoke.cvCreateFileCapture("Url ip camera");

when i run the code say"the tipe cvCreateFileCapture does not exist in CvInvoke"

someone know other form to access an ip camera with emgucv but working...thanks!

Upvotes: 0

Views: 8138

Answers (1)

Juste3alfaz
Juste3alfaz

Reputation: 295

this is my exmaple, it works with me, I a using EmguCV V3

public partial class Form1 : Form
{
    private Capture _capture = null;
    private bool _captureInProgress;
    public Form1()
    {
        InitializeComponent();
        CvInvoke.UseOpenCL = false;
        try
        {
            _capture = new Capture("http://webcam.st-malo.com/axis-cgi/mjpg/video.cgi?");//
            _capture.ImageGrabbed += ProcessFrame;
        }
        catch (NullReferenceException excpt)
        {
            MessageBox.Show(excpt.Message);
        }
    }

    private void ProcessFrame(object sender, EventArgs arg)
    {
        Mat frame = new Mat();
        _capture.Retrieve(frame, 0);

        captureImageBox.Image = frame;

    }

    private void captureButton_Click(object sender, EventArgs e)
    {
        if (_capture != null)
        {
            if (_captureInProgress)
            {  //stop the capture
                captureButton.Text = "Start Capture";
                _capture.Pause();
            }
            else
            {
                //start the capture
                captureButton.Text = "Stop";
                _capture.Start();
            }

            _captureInProgress = !_captureInProgress;
        }
    }
}

enter image description here

Upvotes: 2

Related Questions