本文整理汇总了C#中AForge.Video.DirectShow.VideoCaptureDevice.Start方法的典型用法代码示例。如果您正苦于以下问题:C# VideoCaptureDevice.Start方法的具体用法?C# VideoCaptureDevice.Start怎么用?C# VideoCaptureDevice.Start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AForge.Video.DirectShow.VideoCaptureDevice
的用法示例。
在下文中一共展示了VideoCaptureDevice.Start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Connect
public bool Connect()
{
var videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
if (videoDevices.Count == 0)
{
return false;
}
// create video source
currentDevice = new VideoCaptureDevice(videoDevices[0].MonikerString);
videoSourcePlayer1.VideoSource = currentDevice;
var videoCapabilities = currentDevice.VideoCapabilities;
//foreach (var video in videoCapabilities)
//{
// LogHelper.Info("预览分辨率->" + video.FrameSize.Width + "*" + video.FrameSize.Height);
//}
if (videoCapabilities.Count() > 0)
currentDevice.VideoResolution = currentDevice.VideoCapabilities.Last();
var snapVabalities = currentDevice.SnapshotCapabilities;
//foreach (var snap in snapVabalities)
//{
// LogHelper.Info("抓拍分辨率->" + snap.FrameSize.Width + "*" + snap.FrameSize.Height);
//}
if (snapVabalities.Count() > 0)
currentDevice.SnapshotResolution = currentDevice.SnapshotCapabilities.Last();
currentDevice.Start();
return true;
}
示例2: button1_Click
private void button1_Click(object sender, EventArgs e)
{
cam = new VideoCaptureDevice(webcams[comboBox1.SelectedIndex].MonikerString);
cam.NewFrame += new NewFrameEventHandler(cam_NewFrame);
cam.Start();
}
示例3: button2_Click
private void button2_Click(object sender, EventArgs e)
{
FinalVideo2 = new VideoCaptureDevice(VideoCaptureDevices[comboBox1.SelectedIndex].MonikerString);
FinalVideo2.NewFrame += new NewFrameEventHandler(FinalVideo_NewFrame2);
FinalVideo2.Start();
// FinalVideo.Stop();
}
示例4: button1_Click
public void button1_Click(object sender, EventArgs e)
{
_controller.Connect(new SerialPort((string)comboBox2.SelectedItem, 57600));
videoSource = new VideoCaptureDevice(videoDevices[comboBox1.SelectedIndex].MonikerString);
videoSource.NewFrame += new NewFrameEventHandler(video_NewFrame);
videoSource.Start();
}
示例5: 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();
// ...
//}
}
示例6: 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();
}
}
示例7: btnIniciar_Click
private void btnIniciar_Click(object sender, EventArgs e)
{
if (btnIniciar.Text == "Start")
{
if (ExistenDispositive)
{
FuenteVideo = new VideoCaptureDevice(DispositiveVideo[cboDispositive.SelectedIndex].MonikerString);
FuenteVideo.NewFrame += new NewFrameEventHandler(video_NuevoFrame);
FuenteVideo.Start();
Estado.Text = "Connection Complete";
btnIniciar.Text = "Stop";
cboDispositive.Enabled = false;
groupBox1.Text = DispositiveVideo[cboDispositive.SelectedIndex].Name.ToString();
}
else
Estado.Text = "Error: No matching device.";
}
else {
if (FuenteVideo.IsRunning) {
btnIniciar.Text = "Start";
TerminarFuenteDeVideo();
Estado.Text = "Dispositiveo detenio";
cboDispositive.Enabled = true;
}
}
}
示例8: VideoCaptureDevice
private void btnComeçar_Click(object sender, RoutedEventArgs e)
{
//Iniciar a camera e mostrar no picture Box[form control] por meio do evento
cam = new VideoCaptureDevice(webcam[cmbDevices.SelectedIndex].MonikerString);
cam.NewFrame += new NewFrameEventHandler(cam_NewFrame);
cam.Start();
}
示例9: Cameraint
public static void Cameraint(int i)
{
videoSource = new VideoCaptureDevice(videoDevices[i].MonikerString);
videoSource.DesiredFrameSize = new Size(2048, 1536);
videoSource.DesiredFrameRate = 1;
videoSource.Start();
}
示例10: StartVideo
public void StartVideo()
{
if (filterInfoCollection != null)
{
videoCaptureDevice = new VideoCaptureDevice(filterInfoCollection[1].MonikerString);
try
{
if (videoCaptureDevice.VideoCapabilities.Length > 0)
{
string highestSolution = "0;0";
for (int i = 0; i < videoCaptureDevice.VideoCapabilities.Length; i++)
{
highestSolution = videoCaptureDevice.VideoCapabilities[i].FrameSize.Width.ToString() +';'
+i.ToString();
}
videoCaptureDevice.VideoResolution =
videoCaptureDevice.VideoCapabilities[Convert.ToInt32(highestSolution.Split(';')[1])];
}
}
catch (Exception e)
{
}
videoCaptureDevice.NewFrame += newFrameEventHandler;
videoCaptureDevice.Start();
}
}
示例11: button_iniciar_Click
private void button_iniciar_Click(object sender, EventArgs e)
{
if (button_iniciar.Text.Equals("Iniciar"))
{
if (existem_dispositivos)
{
fonte_video = new VideoCaptureDevice(dispositivos_video[comboBox_dispositivo.SelectedIndex].MonikerString);
fonte_video.NewFrame += new NewFrameEventHandler(VideoNovoFrame);
fonte_video.Start();
//statusStrip_barra.Text = "Executando dispositivo";
button_iniciar.Text = "Parar";
comboBox_dispositivo.Enabled = false;
//label_nome.Text = dispositivos_video[comboBox_camera.SelectedIndex].ToString();
}
else
{
//statusStrip_barra.Text = "Error: Não encontrado dispositivo";
}
}
else
{
if (fonte_video != null)// || fonte_video.IsRunning)
{
TerminarFonteVideo();
//statusStrip_barra.Text = "Dispositivo Terminado";
//button_iniciar.Text = "Iniciar";
comboBox_dispositivo.Enabled = true;
}
}
}
示例12: WebCam
public WebCam(string VideoDeviceMoniker)
{
thisvideoSource = new VideoCaptureDevice(VideoDeviceMoniker);
thisvideoSource.NewFrame += new NewFrameEventHandler(Cam_NewFrame);
thisvideoSource.DesiredFrameRate = 60;
thisvideoSource.Start();
}
示例13: Logic
public Logic()
{
videodevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
videoSource = new VideoCaptureDevice(videodevices[0].MonikerString);
videoSource.NewFrame += videoSource_NewFrame;
videoSource.Start();
}
示例14: button1_Click
private void button1_Click(object sender, EventArgs e)
{
videoSource = new VideoCaptureDevice(videoDevices[0].MonikerString);
videoSource.NewFrame += videoSource_NewFrame;
videoSource.Start();
while (newImage == null){}
videoSource.Stop();
newImage = null;
}
示例15: button3_Click
private void button3_Click(object sender, EventArgs e)
{
videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice); // список устройств
videoSource = new VideoCaptureDevice(videoDevices[0].MonikerString); // подключения устройства
videoSource.NewFrame += new NewFrameEventHandler(videoSource_NewFrame); // создание источника видеосигнала
pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
videoSource.Start();
}