本文整理汇总了C#中Emgu.CV.Capture类的典型用法代码示例。如果您正苦于以下问题:C# Capture类的具体用法?C# Capture怎么用?C# Capture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Capture类属于Emgu.CV命名空间,在下文中一共展示了Capture类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: FormTrain
public FormTrain(Form1 frm1,Classifier_Train cls)
{
InitializeComponent();
_form1 = frm1;
eigenRecog = cls;
face = new HaarCascade("haarcascade_frontalface_default.xml");
eyeWithGlass = new CascadeClassifier("haarcascade_eye_tree_eyeglasses.xml");
mydb = new DBConn();
minEye = new Size(10, 10);
maxEye = new Size(225, 225);
font = new MCvFont(FONT.CV_FONT_HERSHEY_TRIPLEX, 0.5d, 0.5d);
captureT = new Capture();
if (File.ReadAllText("setting.txt") != null)
{
folderPath = File.ReadAllText("setting.txt");
}
else
{
FolderBrowserDialog b = new FolderBrowserDialog();
b.Description = "Please select your installation path";
DialogResult r = b.ShowDialog();
if (r == DialogResult.OK) // Test result.
{
folderPath = b.SelectedPath;
Console.WriteLine(folderPath);
File.WriteAllText(@"setting.txt", folderPath);
MessageBox.Show("Path is at " + folderPath);
}
}
initializeCombobox();
Application.Idle += new EventHandler(TrainFrame);
}
开发者ID:pathom2000,项目名称:Face-Rcognition-with-Augmented-Reality,代码行数:35,代码来源:FormTrain.cs
示例2: RileeCapture
public RileeCapture()
{
InitializeComponent();
btnDrawMasterImage.Enabled = false;
//initialization for recognition boxes
_limgMasters.Add(imbMaster1);
_limgMasters.Add(imbMaster2);
_limgMasters.Add(imbMaster3);
_limgMasters.Add(imbMaster4);
_limgMasters.Add(imbMaster5);
try
{
_capture = new Capture();
_capture.ImageGrabbed += ProcessFrame;
_capture.Start();
tslStatus.Text = "Capture started";
//flip horizontal to natural
//if ((_capture != null)&&(!_capture.FlipHorizontal)) _capture.FlipHorizontal = true;
}
catch (NullReferenceException ex)
{
tslStatus.Text = "Capture initialization failed...";
MessageBox.Show(ex.Message);
}
}
开发者ID:RichardxLee,项目名称:RileeCapture,代码行数:28,代码来源:RileeCapture.cs
示例3: button1_Click
private void button1_Click(object sender, EventArgs e)
{
#region if capture is not created, create it now
if (capture == null)
{
try
{
capture = new Capture();
}
catch (NullReferenceException excpt)
{
MessageBox.Show(excpt.Message);
}
}
#endregion
if (capture != null)
{
if (captureInProgress)
{ //if camera is getting frames then stop the capture and set button Text
// "Start" for resuming capture
button1.Text = "Start!"; //
Application.Idle -= ProcessFrame;
}
else
{
//if camera is NOT getting frames then start the capture and set button
// Text to "Stop" for pausing capture
button1.Text = "Stop";
Application.Idle += ProcessFrame;
}
captureInProgress = !captureInProgress;
}
}
开发者ID:GrazianoFracasso,项目名称:emgu,代码行数:35,代码来源:Form1.cs
示例4: Form1
public Form1()
{
InitializeComponent();
//try to create the capture
if (_capture == null)
{
try
{
_capture = new Capture();
}
catch (NullReferenceException excpt)
{ //show errors if there is any
MessageBox.Show(excpt.Message);
}
}
if (_capture != null) //if camera capture has been successfully created
{
_motionHistory = new MotionHistory(
1.0, //in second, the duration of motion history you wants to keep
0.05, //in second, parameter for cvCalcMotionGradient
0.5); //in second, parameter for cvCalcMotionGradient
Application.Idle += ProcessFrame;
}
}
开发者ID:Rustemt,项目名称:emgu_openCV,代码行数:27,代码来源:Form1.cs
示例5: Main
static void Main(string[] args)
{
navigationMatrix = new Matrix3D();
navigationMatrix.Translate(new Vector3D(0, 100, 110));
navigationMatrix.Scale(new Vector3D((double)1 / 5, (double)1 / 5, (double)1 / 5));
displayProfile = new Bin[Bin.RANGEL, Bin.RANGEA, Bin.RANGEB];
for (int l = 0; l < Bin.RANGEL; l++)
for (int a = 0; a < Bin.RANGEA; a++)
for (int b = 0; b < Bin.RANGEB; b++)
displayProfile[l, a, b] = new Bin(l, a, b);
PopulateProfile(displayProfile, navigationMatrix);
String path = Environment.CurrentDirectory + PATH_TO_VIDEO;
if (!System.IO.File.Exists(path))
return;
//Opens the movie file
capture = new Capture(path);
double fps = capture.GetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FPS);
//Reads frame by frame
Timer timer = new Timer(1000 / fps);
timer.Elapsed += new ElapsedEventHandler(timer_Elapsed);
timer.Start();
Console.Read();
}
开发者ID:hcilab-um,项目名称:STColorCorrection,代码行数:30,代码来源:Program.cs
示例6: AIRecognition
public AIRecognition()
{
InitializeComponent();
_faceClassifier = new CascadeClassifier("haarcascade_frontalface_default.xml");
Loaded += (s, e) =>
{
_vmodel.Pictures.Clear();
_vmodel.PersonRecognized = 0;
this.DataContext = _vmodel;
if (grabber == null)
{
CommonData.LoadSavedData();
//check how many faces we already have
_countFaces = CommonData.PicturesVM.Pictures.Count;
grabber = new Capture();
grabber.QueryFrame();
grabber.Start();
}
else
{
grabber.Start();
}
};
Unloaded += (s, e) =>
{
grabber.Stop();
};
CompositionTarget.Rendering += CompositionTarget_Rendering;
}
开发者ID:davluzzu,项目名称:FaceAuth,代码行数:35,代码来源:AIRecognition.xaml.cs
示例7: Program
public Program()
{
bool isProcessing = false;
this._stopwatch = new System.Diagnostics.Stopwatch();
this._capture = new Capture();
this.components = new System.ComponentModel.Container();
this.contextMenu = new System.Windows.Forms.ContextMenu();
this.menuItem = new System.Windows.Forms.MenuItem();
this.contextMenu.MenuItems.AddRange(
new System.Windows.Forms.MenuItem[] { this.menuItem });
this.menuItem.Index = 0;
this.menuItem.Text = "E&xit";
this.menuItem.Click += new System.EventHandler(
delegate(object sender, EventArgs e) {
Application.Exit();
});
this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
notifyIcon.Icon = new Icon("info.ico");
notifyIcon.ContextMenu = this.contextMenu;
notifyIcon.Text = "Shoulder Surfer Alert";
notifyIcon.Visible = true;
this._runner = new System.Threading.Timer(new System.Threading.TimerCallback(
delegate(object state) {
if (!(bool)state) {
state = true;
this.ProcessFaces();
state = false;
}
}), isProcessing, 0, 500);
}
开发者ID:wendellinfinity,项目名称:ShoulderSurferAlert,代码行数:32,代码来源:Program.cs
示例8: run
private void run()
{
Image<Bgr, Byte> image = new Image<Bgr, byte>("lena.jpg"); //Read the files as an 8-bit Bgr image
Capture vid = new Capture("kw.avi");
vid.FlipVertical = true;
int x = 0;
TimeSpan time = TimeSpan.Zero;
MCvFont font = new MCvFont(Emgu.CV.CvEnum.FONT.CV_FONT_HERSHEY_COMPLEX, 1.0, 1.0);
using (VideoWriter vw = new VideoWriter("out3.avi", 15, 640, 480, true))
{
while (vid.Grab())
{
//if (++x % 1 != 0) continue;
image = vid.RetrieveBgrFrame();
long detectionTime;
List<Rectangle> faces = new List<Rectangle>();
List<Rectangle> eyes = new List<Rectangle>();
DetectFace.Detect(image, "haarcascade_frontalface_default.xml", "supersmile.xml", faces, eyes, out detectionTime);
foreach (Rectangle face in faces)
image.Draw(face, new Bgr(Color.Red), 2);
foreach (Rectangle eye in eyes)
image.Draw(eye, new Bgr(Color.Blue), 2);
if (eyes.Count > 0) time = time.Add(new TimeSpan(0, 0, 0, 0, 66));
//display the image
image.Draw(String.Format("{0}:{1}", time.Seconds, time.Milliseconds), ref font, new Point(50, 50), new Bgr(0, 0, 255));
setimage(image);
vw.WriteFrame<Bgr, Byte>(image);
}
}
}
开发者ID:vicot,项目名称:budzik,代码行数:33,代码来源:Form1.cs
示例9: StartClient
private static void StartClient()
{
th_cli = new Thread (delegate() {
try
{
ConsoleAdditives.WriteHeader("Stream started");
Capture cap = new Capture();
while(_isRunning) {
byte[] buf = cap.QueryGrayFrame().Bytes;
int buflp = buf.Length/5;
for(byte i=0;i<5;i++)
{
byte[] tbuf = new byte[buflp];
tbuf[0]=i;
for(int j=1;j<buflp;j++)
{
tbuf[j]=buf[i*buflp+j];
}
client.Send(tbuf,buflp,remoteEP);
}
}
ConsoleAdditives.WriteHeader("Stream stoped");
}
catch(Exception ex)
{
Console.WriteLine(ex.ToString());
}
});
th_cli.Start ();
}
开发者ID:Lucius671,项目名称:MonolithRobot,代码行数:32,代码来源:CamClient.cs
示例10: StartStreaming
public void StartStreaming()
{
grabber = new Capture();
grabber.QueryFrame();
Application.Idle += new EventHandler(FrameGrabber);
//All.Enabled = false;
}
开发者ID:marcasselin,项目名称:face-rec-opencv,代码行数:7,代码来源:FaceRecognizer.cs
示例11: Form1
public Form1()
{
InitializeComponent();
//try to create the capture
if (_capture == null)
{
try
{
_capture = new Capture();
}
catch (NullReferenceException excpt)
{ //show errors if there is any
MessageBox.Show(excpt.Message);
}
}
if (_capture != null) //if camera capture has been successfully created
{
_motionHistory = new MotionHistory(
6, //number of images to store in buffer, adjust it to fit your camera's frame rate
20, //0-255, the amount of pixel intensity change to consider it as motion pixel
1.0, //in second, the duration of motion history you wants to keep
0.05, //in second, parameter for cvCalcMotionGradient
0.5); //in second, parameter for cvCalcMotionGradient
Application.Idle += new EventHandler(ProcessFrame);
}
}
开发者ID:ideamonk,项目名称:SpaceLock,代码行数:30,代码来源:Form1.cs
示例12: VideoEmgu
public VideoEmgu(GraphicsDevice device, int camIndex)
{
this.device = device;
capture = new Capture(camIndex);
frame = new Texture2D(device, capture.Width, capture.Height);
colorData = new Color[capture.Width * capture.Height];
}
开发者ID:Iridio,项目名称:XNAFaceDetection,代码行数:7,代码来源:VideoEmgu.cs
示例13: FormImageRetrieve
public FormImageRetrieve(FormManageData formMD)
{
_formMD = formMD;
capture = new Capture();
InitializeComponent();
Application.Idle += new EventHandler(runningFrame);
}
开发者ID:pathom2000,项目名称:Face-Rcognition-with-Augmented-Reality,代码行数:7,代码来源:FormImageRetrieve.cs
示例14: captureButton_Click
private void captureButton_Click(object sender, EventArgs e)
{
if (capture == null)
{
try
{
capture = new Capture();
}
catch (NullReferenceException exception)
{
MessageBox.Show(exception.Message);
}
catch (TypeInitializationException exc)
{
MessageBox.Show(
"Attention: You have to copy all the assemblies and native libraries from an official release of EmguCV to the directory of the demo." +
Environment.NewLine + Environment.NewLine + exc);
}
}
if (capture != null)
{
if (Capturing)
{
captureButton.Text = "Start Capturing";
Application.Idle -= DoDecoding;
}
else
{
captureButton.Text = "Stop Capturing";
Application.Idle += DoDecoding;
}
Capturing = !Capturing;
}
}
开发者ID:n1rvana,项目名称:ZXing.NET,代码行数:35,代码来源:EmguCVDemoForm.cs
示例15: startPreview
private void startPreview()
{
#region Create capture object if it is not already created
if (_capture == null)
{
try
{
_capture = new Capture();
}
catch (NullReferenceException excpt)
{
MessageBox.Show(excpt.Message);
}
}
#endregion
#region Start the capture process and display in the preview window
if (_capture != null)
{
//start the capture
//Application.Idle += ProcessFrame;
captureEnabled = true;
System.Threading.Thread capThread = new System.Threading.Thread(new System.Threading.ThreadStart(captureThread));
capThread.Start();
}
#endregion
}
开发者ID:thaisdannyrocha,项目名称:monobooth,代码行数:33,代码来源:frmMain.cs
示例16: Form1_Load
private void Form1_Load(object sender, EventArgs e)
{
capturar = new Capture(0);
haarCascade1 = new HaarCascade("haarcascade_frontalface_default.xml");
timer1.Interval = 40;
timer1.Enabled=true;
}
开发者ID:Santtt,项目名称:emguDeteccion,代码行数:7,代码来源:Form1.cs
示例17: btnKamera_Click
private void btnKamera_Click(object sender, EventArgs e)
{
if (tangkap == null)
{
try
{
tangkap = new Capture();
}
catch (NullReferenceException excpt)
{
MessageBox.Show(excpt.Message);
}
}
if (tangkap != null)
{
if (btnKamera.Text=="Berhenti Kamera")
{
btnKamera.Text = "Mulai Kamera";
Application.Idle -= ProsesMenangkapFrame;
}
else
{
btnKamera.Text = "Berhenti Kamera";
Application.Idle += ProsesMenangkapFrame;
}
}
}
开发者ID:mirahanugraheny,项目名称:TugasBesarSismul_DeteksiWajah,代码行数:28,代码来源:DeteksiWajah.cs
示例18: Form1
public Form1()
{
InitializeComponent();
cap = new Capture(); // conexión con la primera cámara
// o cap = new Capture(0); -- idéntico al anterior
// o cap = new Capture(“miVideo.avi”); -- carga un vídeo
}
开发者ID:Tales22,项目名称:AirTFG,代码行数:7,代码来源:Form1.cs
示例19: captureButton_Click
private void captureButton_Click(object sender, EventArgs e)
{
#region if capture is not created, create it now
if (_capture == null)
{
try
{
_capture = new Capture();
}
catch (NullReferenceException excpt)
{
MessageBox.Show(excpt.Message);
}
}
#endregion
if (_capture != null)
{
if (_captureInProgress)
{ //stop the capture
Application.Idle -= new EventHandler(ProcessFrame);
captureButton.Text = "Start Capture";
}
else
{
//start the capture
captureButton.Text = "Stop";
Application.Idle += new EventHandler(ProcessFrame);
}
_captureInProgress = !_captureInProgress;
}
}
开发者ID:tuxoko,项目名称:camfight,代码行数:33,代码来源:Form1.cs
示例20: Form1
public Form1()
{
InitializeComponent();
cap = new Capture();
timer1.Start();
Form1_Load();
}
开发者ID:Maciox55,项目名称:RECounter,代码行数:7,代码来源:Form1.cs
注:本文中的Emgu.CV.Capture类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论