2017年4月30日 星期日

C# IPCAM

D-Link 931L
尚未使用emgu(open cv)進行影像處理





using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Net;
using Emgu.CV;
using Emgu.CV.Structure;
using Emgu.Util;

namespace test
{
    public partial class Form1 : Form
    {
        //IPCAM:D-Link 931L 
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            
        }
       
        private void button1_Click(object sender, EventArgs e)
        {
           timer1.Enabled = false;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            timer1.Enabled = true;
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            string sourceURL = "http://"+textBox1.Text+"/image/jpeg.cgi";

            // create HTTP request
            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(sourceURL);

            //add id,password
            req.Credentials = new NetworkCredential("ooo", "xxx");//ooo為帳號,xxx為密碼

            // get response
            WebResponse resp = req.GetResponse();

            // get response stream
            Bitmap bmp = new Bitmap(resp.GetResponseStream());

            //show image in picturebox
            pictureBox1.Image = bmp;

        }
    }
}


沒有留言:

張貼留言