本文整理汇总了C#中AForge.Video.DirectShow.FilterInfoCollection类的典型用法代码示例。如果您正苦于以下问题:C# FilterInfoCollection类的具体用法?C# FilterInfoCollection怎么用?C# FilterInfoCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FilterInfoCollection类属于AForge.Video.DirectShow命名空间,在下文中一共展示了FilterInfoCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: start
public void start()
{
Detector = Detector == null ? new Detector() : Detector;
Detector.Detection += DetectorOnDetection;
Dick = new Dick(Detector);
if (!Detector.Detectors.Any())
{
for (int i = 0; i < 4; i++)
{
Detector.Detectors.Add(new ColorDetector());
}
}
Detector.Detectors.ForEach(x=> x.Detector = Detector);
var cd = Detector.Detectors[0];
Dick.DickParts.Add(new DickPart(PartName.Tip, cd));
cd = Detector.Detectors[1];
Dick.DickParts.Add(new DickPart(PartName.Medium, cd));
cd = Detector.Detectors[2];
Dick.DickParts.Add(new DickPart(PartName.Deep, cd));
cd = Detector.Detectors[3];
Dick.DickParts.Add(new DickPart(PartName.RealyDeep, cd));
cmbDickPart.DataSource = Dick.DickParts;
cmbDickPart.DisplayMember = "strName";
FilterInfoCollection videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
Detector.Video = new VideoCaptureDevice(videoDevices[0].MonikerString);
Detector.Start();
}
示例2: minero_class
public minero_class(int puerto = 2134, GLOBAL_MODE modo = GLOBAL_MODE.MINI_MINERO)
{
_modoOperacion = modo;
bmp1 = new Bitmap(640, 480, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
bw = new BackgroundWorker();
_puerto = puerto;
ipEnd = new IPEndPoint(IPAddress.Any, _puerto);
bw.DoWork += new DoWorkEventHandler(bw_DoWork);
if (_modoOperacion == GLOBAL_MODE.MINI_MINERO)
{
modeloRobot.setDeviceIndex(3);
}
else
{
modeloRobot.setDeviceIndex(4);
}
try
{
// enumerate video devices
videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
// create video source
videoSource = new VideoCaptureDevice(videoDevices[0].MonikerString);
// set NewFrame event handler
videoSource.NewFrame += videoSource_NewFrame;
}
catch (Exception ex)
{
}
//jo¿ystick
joy.JoystickEvent += joy_JoystickEvent;
}
示例3: SelectDevice
public SelectDevice()
{
InitializeComponent();
this.cameraDeviceNum = 0;
#region
this.videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
if (this.videoDevices.Count != 0)
{
//リストクリア
this.listDevices.Items.Clear();
//デバイス追加
foreach (FilterInfo device in videoDevices)
{
this.listDevices.Items.Add(device.Name);
this.cameraDeviceNum++;
}
this.listDevices.Items.Add("kinect");
this.listDevices.SelectedIndex = 0;
}
else
{
this.listDevices.Items.Clear();
this.listDevices.Items.Add("Kinect");
this.listDevices.SelectedIndex = 0;
}
#endregion
this.Show();
}
示例4: VideoCaptureDeviceForm
// Constructor
public VideoCaptureDeviceForm( )
{
InitializeComponent( );
// show device list
try
{
// enumerate video devices
videoDevices = new FilterInfoCollection( FilterCategory.VideoInputDevice );
if ( videoDevices.Count == 0 )
throw new ApplicationException( );
// add all devices to combo
foreach ( FilterInfo device in videoDevices )
{
devicesCombo.Items.Add( device.Name );
}
}
catch ( ApplicationException )
{
devicesCombo.Items.Add( "No local capture devices" );
devicesCombo.Enabled = false;
okButton.Enabled = false;
}
devicesCombo.SelectedIndex = 0;
}
示例5: CargarDispositive
public void CargarDispositive(FilterInfoCollection Dispositive)
{
for (int i = 0; i < Dispositive.Count; i++) {
cboDispositive.Items.Add(Dispositive[i].Name.ToString());
cboDispositive.Text = cboDispositive.Items[0].ToString();
}
}
示例6: GetCamListCombobox
//GetCamList
public static void GetCamListCombobox(ComboBox c)
{
WebCamList = c;
try
{
VideoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
WebCamList.Items.Clear();
foreach (FilterInfo device in VideoDevices)
{
WebCamList.Items.Add(device.Name);
}
if (Properties.Settings.Default.WebCamDevice == null)
{
WebCamList.SelectedIndex = 0; //First cam found is default
}
else
{
WebCamList.SelectedIndex = WebCamList.FindString(Properties.Settings.Default.WebCamDevice);
}
}
catch (ApplicationException)
{
//DeviceExist = false;
WebCamList.Items.Add("No capture device on your system");
}
}
示例7: GetFrame
public void GetFrame()
{
// enumerate video devices
var videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
//foreach (FilterInfo item in videoDevices)
//{
//videoSource = new VideoCaptureDevice(item.MonikerString);
videoSource = new VideoCaptureDevice(videoDevices[1].MonikerString);
//videoSource.DesiredFrameSize = new Size(160, 120);
// create video source
//VideoCaptureDevice videoSource = new VideoCaptureDevice(videoDevices[0].MonikerString);
// set NewFrame event handler
videoSource.NewFrame += new NewFrameEventHandler(video_NewFrame);
// start the video source
videoSource.Start();
// ...
System.Threading.Thread.Sleep(500);
Trace.WriteLine("FramesReceived: " + videoSource.FramesReceived);
// signal to stop
videoSource.SignalToStop();
// ...
//}
}
示例8: Form1
public Form1()
{
InitializeComponent();
dm.setDeviceIndex(3);
comboBox2.DataSource = Enum.GetValues(typeof(MODELO_TYPE));
// enumerate video devices
videoDevices = new FilterInfoCollection(
FilterCategory.VideoInputDevice);
// create video source
videoSource = new VideoCaptureDevice(
videoDevices[0].MonikerString);
// set NewFrame event handler
videoSource.NewFrame += new NewFrameEventHandler(video_NewFrame);
/*ax12_Rot = new AX_12_Motor();
ax12_Dir = new AX_12_Motor();
ax12_Dir.setDeviceID(3);
ax12_Rot.setDeviceID(3);
ax12_Dir.setBaudSpeed(BAUD_RATE.BAUD_1Mbps);
ax12_Rot.setBaudSpeed(BAUD_RATE.BAUD_1Mbps);*/
//button3_Click(null, null);
}
示例9: button1_Click
private void button1_Click(object sender, EventArgs e)
{
capturedevice = new FilterInfoCollection(FilterCategory.VideoInputDevice);
if (pictureBox2.Image != null)
{
pictureBox1.Image = (Image)pictureBox2.Image.Clone();
}
else
{
MessageBox.Show("check the camera");
}
////////////////////
IBarcodeReader reader = new BarcodeReader();
// load a bitmap
var barcodeBitmap = (Bitmap)pictureBox1.Image;
// detect and decode the barcode inside the bitmap
var result = reader.Decode(barcodeBitmap);
// do something with the result
if (result != null)
{
txtDecoderType.Text = result.BarcodeFormat.ToString();
txtDecoderContent.Text = result.Text;
Console.Beep();
}
}
示例10: Form1_Load
private void Form1_Load(object sender, EventArgs e)
{
try
{
///---实例化对象
USE_Webcams = new FilterInfoCollection(FilterCategory.VideoInputDevice);
///---摄像头数量大于0
if (USE_Webcams.Count > 0)
{
///---禁用按钮
btn_Start.Enabled = true;
///---实例化对象
cam = new VideoCaptureDevice(USE_Webcams[0].MonikerString);
///---绑定事件
cam.NewFrame += new NewFrameEventHandler(Cam_NewFrame);
}
else
{
///--没有摄像头
btn_Start.Enabled = false;
///---提示没有摄像头
MessageBox.Show("没有摄像头外设");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
示例11: Start
public void Start()
{
FilterInfoCollection videoDevices;
string camDescr;
try
{
videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
if (videoDevices.Count == 0)
{
throw new ApplicationException("no webcams");
}
else
{
camName = videoDevices[Convert.ToInt32(devIndex)].MonikerString;
camDescr = videoDevices[Convert.ToInt32(devIndex)].Name;
}
}
catch (ApplicationException)
{
throw new ApplicationException("failed web cams initialize");
}
videoSource = new VideoCaptureDevice(camName);
videoSource.NewFrame += new NewFrameEventHandler(video_NewFrame);
videoSource.DesiredFrameSize = new Size(Convert.ToInt32(devWidth), Convert.ToInt32(devHeigth));//new Size(320, 240);//new Size(480, 360);//new Size(640, 480);//
videoSource.DesiredFrameRate = 29;
videoSource.Start();
if (timerUploadImage == null)
{
timerUploadImage = new System.Timers.Timer(700);
timerUploadImage.Elapsed += new ElapsedEventHandler(timerUploadImage_Tick);
timerUploadImage.Start();
}
}
示例12: Form1
public Form1()
{
InitializeComponent();
// show device list
try
{
// enumerate video devices
videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
if (videoDevices.Count == 0)
throw new ApplicationException();
// add all devices to combo
foreach (FilterInfo device in videoDevices)
{
devicesCombo.Items.Add(device.Name);
}
}
catch (ApplicationException)
{
devicesCombo.Items.Add("No local capture devices");
devicesCombo.Enabled = false;
takePictureBtn.Enabled = false;
}
devicesCombo.SelectedIndex = 0;
VideoCaptureDevice videoCaptureSource = new VideoCaptureDevice(videoDevices[devicesCombo.SelectedIndex].MonikerString);
videoSourcePlayer.VideoSource = videoCaptureSource;
videoSourcePlayer.Start();
}
示例13: FilterInfoCollection
/// <summary>
/// 获取摄像头列表
/// </summary>
/// <returns></returns>
public List<string>GetCameraList()
{
List<string> lstReturn = new List<string>();
try
{
VideoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
if (VideoDevices.Count == 0)
{
throw new ApplicationException();
}
foreach (FilterInfo device in VideoDevices)
{
lstReturn.Add(device.Name);
}
}
catch (ApplicationException)
{
lstReturn.Add("未发现本地视频设备");
VideoDevices = null;
}
return lstReturn;
}
示例14: execute
public void execute()
{
LocationSourceManager.Instance.Shutdown();
this.videoPlayer.SignalToStop();
this.videoPlayer.WaitForStop();
FilterInfoCollection videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
VideoCaptureDevice videoSource = new VideoCaptureDevice(videoDevices[this.videoSourceCombo.SelectedIndex].MonikerString);
int i = this.videoFormatCombo.SelectedIndex;
videoSource.DesiredFrameSize = videoSource.VideoCapabilities[i].FrameSize;
Size videoPlayerSize = videoSource.VideoCapabilities[i].FrameSize;
videoPlayer.Size = videoPlayerSize;
Size videoPlayerParentSize = videoPlayer.Parent.Size;
videoPlayer.Location = new Point((videoPlayerParentSize.Width / 2) - (videoPlayerSize.Width / 2), (videoPlayerParentSize.Height / 2) - (videoPlayerSize.Height / 2));
new UpdateMapSizeAndPosition(this.videoPlayer, MapOverlayForm.Instance).execute();
Size mainFormMinSize = videoPlayerSize;
mainFormMinSize.Width += 230;
mainFormMinSize.Height += 50;
if (mainFormMinSize.Height < 475)
mainFormMinSize.Height = 475;
this.mainForm.MinimumSize = mainFormMinSize;
this.videoPlayer.VideoSource = videoSource;
this.videoPlayer.Start();
}
示例15: GetFirstCameraDevice
public CameraDevice GetFirstCameraDevice()
{
CameraDevice cameraDevice = null;
// enumerate video devices
FilterInfoCollection videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
if ((videoDevices != null) && (videoDevices.Count > 0))
{
// create video source
VideoCaptureDevice videoDevice = new VideoCaptureDevice(videoDevices[0].MonikerString);
List<CameraDevice> devicesData = _config.GetConfiguredCameraDevicesData().Where(a => a.ID == videoDevice.Source).ToList();
if ((devicesData != null) && (devicesData.Count > 0))
{
cameraDevice = devicesData[0];
}
else
{
cameraDevice = new LocalCameraDevice();
cameraDevice.ID = videoDevice.Source;
cameraDevice.Name = "Camera";
_config.AddCameraDevice(cameraDevice);
_config.Save();
}
(cameraDevice as LocalCameraDevice).Init(videoDevice);
}
return cameraDevice;
}