Example #1
0
 //打开摄像机
 public void OpenCamera(int cameraIndex, int formatIndex)
 {
     if (cameraIndex < 0 || cameraIndex >= OeipManager.Instance.OeipDevices.Count)
     {
         return;
     }
     if (oeipCamera != null)
     {
         oeipCamera.Close();
     }
     oeipCamera.SetDevice(OeipManager.Instance.OeipDevices[cameraIndex]);
     this.formatIndex = formatIndex;
     if (this.formatIndex < 0)
     {
         this.formatIndex = oeipCamera.FindFormatIndex(1920, 1080);
     }
     SetFormat(this.formatIndex);
 }
Example #2
0
        private void cbx_cameraList_SelectedIndexChanged(object sender, EventArgs e)
        {
            cbx_formatList.Items.Clear();
            var newCamera = (OeipDeviceInfo)cbx_cameraList.SelectedItem;

            if (newCamera.id < 0)
            {
                return;
            }
            if (camera.IsOpen)
            {
                camera.Close();
            }
            camera.SetDevice(newCamera);
            foreach (var format in camera.VideoFormats)
            {
                cbx_formatList.Items.Add(format.width + "x" + format.height + " " + format.fps + "fps " + format.GetVideoType());
            }
            int formatIndex = camera.FindFormatIndex(1920, 1080);

            SetFormat(formatIndex);
        }