예제 #1
0
        public List <DeviceCapabilityInfo> GetDeviceCapability(DeviceInfo deviceInfo)
        {
            List <DeviceCapabilityInfo> deviceCapability = new List <DeviceCapabilityInfo>();
            VideoCaptureDevice          video            = new VideoCaptureDevice(deviceInfo.MonikerString);

            for (int i = 0; i < video.VideoCapabilities.Length; i++)
            {
                VideoCapabilities    cap     = video.VideoCapabilities[i];
                DeviceCapabilityInfo capInfo = new DeviceCapabilityInfo(cap.FrameSize, cap.FrameRate);
                deviceCapability.Add(capInfo);
            }
            return(deviceCapability);
        }
예제 #2
0
 public bool StartVideo(DeviceInfo device, DeviceCapabilityInfo info)
 {
     try
     {
         Size frameSize = info.FrameSize;
         int  rate      = info.MaxFrameRate;
         videoSource = new VideoCaptureDevice(device.MonikerString);
         videoSource.DesiredFrameSize = frameSize;
         videoSource.DesiredFrameRate = rate;
         videoSource.NewFrame        += new AForge.Video.NewFrameEventHandler(videoSource_NewFrame);
         videoSource.Start();
         DeviceExist = true;
         return(true);
     }
     catch
     {
         return(false);
     }
 }
예제 #3
0
 private void comboBoxEx2_SelectedIndexChanged(object sender, EventArgs e)
 {
     _DeviceCapabilityInfo = (DeviceCapabilityInfo)comboBoxEx2.SelectedItem;
 }
예제 #4
0
 private void comboBoxEx1_SelectedIndexChanged(object sender, EventArgs e)
 {
     comboBoxEx2.Items.Clear();
     _DeviceCapabilityInfo = null;
     _DeviceInfo = (DeviceInfo)comboBoxEx1.SelectedItem;
     foreach (DeviceCapabilityInfo info in camera.GetDeviceCapability(_DeviceInfo))
     {
         comboBoxEx2.Items.Add(info);
     }
 }
예제 #5
0
 public List<DeviceCapabilityInfo> GetDeviceCapability(DeviceInfo deviceInfo)
 {
     List<DeviceCapabilityInfo> deviceCapability = new List<DeviceCapabilityInfo>();
         VideoCaptureDevice video = new VideoCaptureDevice(deviceInfo.MonikerString);
         for (int i = 0; i < video.VideoCapabilities.Length; i++)
         {
             VideoCapabilities cap = video.VideoCapabilities[i];
             DeviceCapabilityInfo capInfo = new DeviceCapabilityInfo(cap.FrameSize, cap.FrameRate);
             deviceCapability.Add(capInfo);
         }
         return deviceCapability;
 }
예제 #6
0
 public bool StartVideo(DeviceInfo device, DeviceCapabilityInfo info)
 {
     try
         {
             Size frameSize = info.FrameSize;
             int rate = info.MaxFrameRate;
             videoSource = new VideoCaptureDevice(device.MonikerString);
             videoSource.DesiredFrameSize = frameSize;
             videoSource.DesiredFrameRate = rate;
             videoSource.NewFrame += new AForge.Video.NewFrameEventHandler(videoSource_NewFrame);
             videoSource.Start();
             DeviceExist = true;
             return true;
         }
         catch
         {
             return false;
         }
 }