public CamshiftDemo() { InitializeComponent(); bar_ValueChanged(null, null); //write values to variables init(); //create histograms try { #if FILE_CAPTURE string resourceDir = Path.Combine(Directory.GetParent(Directory.GetCurrentDirectory()).FullName, "Resources"); videoCapture = new ImageDirectoryReader(Path.Combine(resourceDir, "ImageSequence"), "*.jpg"); roi = new Rectangle(180, 285, 75, 120); isROISelected = true; this.barVMin.Value = 100; #else videoCapture = new CameraCapture(0); #endif } catch (Exception) { MessageBox.Show("Cannot find any camera!"); return; } if (videoCapture is CameraCapture) { (videoCapture as CameraCapture).FrameSize = new Size(640, 480); //set new Size(0,0) for the lowest one } this.FormClosing += CamshiftDemo_FormClosing; Application.Idle += videoCapture_InitFrame; videoCapture.Open(); }
public FastTPDemo() { InitializeComponent(); initialize(); try { #if FILE_CAPTURE string resourceDir = Path.Combine(Directory.GetParent(Directory.GetCurrentDirectory()).FullName, "Resources"); videoCapture = new ImageDirectoryReader(Path.Combine(resourceDir, "ImageSequence"), "*.jpg"); #else videoCapture = new CameraCapture(0); #endif } catch (Exception ex) { MessageBox.Show(ex.Message); return; } if (videoCapture is CameraCapture) { (videoCapture as CameraCapture).FrameSize = new Size(640 / 2, 480 / 2); //set new Size(0,0) for the lowest one } this.FormClosing += FastTPDemo_FormClosing; Application.Idle += videoCapture_NewFrame; videoCapture.Open(); }
public SimpleParticleDemoForm() { InitializeComponent(); init(); try { //videoCapture = new CameraCapture(0); string resourceDir = Path.Combine(Directory.GetParent(Directory.GetCurrentDirectory()).FullName, "Resources"); videoCapture = new ImageDirectoryReader(Path.Combine(resourceDir, "ImageSequence"), "*.jpg"); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } if (videoCapture is CameraCapture) (videoCapture as CameraCapture).FrameSize = imgSize; videoCapture.Open(); this.FormClosing += ColorParticleDemo_FormClosing; Application.Idle += videoCapture_ProcessFrame; }
public FastTP() { InitializeComponent(); TemplPyrs = new List <TemplatePyramid>(); TMP = new TemplateMatching(); string[] fileNames = { "TP-A.bmp", "ha-ha-you-lose.bmp" }; TemplPyrs = TemplateMatching.fromFiles(fileNames, true, CropToSqr: true); //TemplPyrs = TemplateMatching.fromXML("demo.xmll"); try { #if FILE_CAPTURE //string resourceDir = Path.Combine(Directory.GetParent(Directory.GetCurrentDirectory()).FullName, "Resources"); videoCapture = new ImageDirectoryCapture(@"./", "TP.bmp"); #else videoCapture = new CameraCapture(1); #endif } catch (Exception ex) { MessageBox.Show(ex.Message); return; } if (videoCapture is CameraCapture) { (videoCapture as CameraCapture).FrameSize = new DotImaging.Primitives2D.Size(1600 / 2, 1200 / 2); //set new Size(0,0) for the lowest one } this.FormClosing += FastTP_FormClosing; Application.Idle += videoCapture_NewFrame; videoCapture.Open(); }
public ParticleFilterModelFittingDemo() { InitializeComponent(); init(); try { string resourceDir = Path.Combine(Directory.GetParent(Directory.GetCurrentDirectory()).FullName, "Resources"); videoCapture = new ImageDirectoryReader(Path.Combine(resourceDir, "SampleVideos", "1"), "*.jpg"); //1st sample //videoCapture = new ImageDirectoryReader(Path.Combine(resourceDir, "SampleVideos", "2"), "*.jpg"); //2nd sample } catch (Exception) { MessageBox.Show("Cannot find any camera!"); return; } if (videoCapture is CameraCapture) { (videoCapture as CameraCapture).FrameSize = imgSize; } this.FormClosing += ColorParticleDemo_FormClosing; Application.Idle += videoCapture_ProcessFrame; videoCapture.Open(); }
public SimpleParticleDemoForm() { InitializeComponent(); init(); try { //videoCapture = new CameraCapture(0); string resourceDir = Path.Combine(Directory.GetParent(Directory.GetCurrentDirectory()).FullName, "Resources"); videoCapture = new ImageDirectoryReader(Path.Combine(resourceDir, "ImageSequence"), "*.jpg"); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } if (videoCapture is CameraCapture) { (videoCapture as CameraCapture).FrameSize = imgSize; } videoCapture.Open(); this.FormClosing += ColorParticleDemo_FormClosing; Application.Idle += videoCapture_ProcessFrame; }
public KalmanTrackingDemo() { InitializeComponent(); #if FILE_CAPTURE roi = new Rectangle(115, 220, 30, 15); //user defined rectangle for sample video isROISelected = true; #endif bar_ValueChanged(null, null); //write values to variables initalizeHistograms(); //create histograms try { #if FILE_CAPTURE string videoDir = Path.Combine(Directory.GetParent(Directory.GetCurrentDirectory()).FullName, "Resources", "Sequence"); videoCapture = new ImageDirectoryCapture(videoDir, "*.jpg"); #else videoCapture = new CameraCapture(0); #endif } catch (Exception) { MessageBox.Show("Cannot find any camera!"); return; } this.FormClosing += CamshiftDemo_FormClosing; Application.Idle += videoCapture_InitFrame; videoCapture.Open(); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); ImageStreamReader capture = null; string databaseFileName = null; using (var wizard = new Wizard()) { wizard.ShowDialog(); capture = wizard.CaptureObj; databaseFileName = wizard.DatabaseFileName; } //capture = new ImageDirectoryReader(@"C:\Users\Darko-Home\Desktop\HandDatabase\prepared\Nenad_Darko\Tomislav 1\", "*.jpg"); //databaseFileName = @"C:\Users\Darko-Home\Desktop\HandDatabase\prepared\Nenad_Darko\Tomislav 1.xml"; if (capture == null) //a user clicked "X" without data selection { //MessageBox.Show("Capture or database file name is null!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } capture.Open(); if (capture.Length == 0) { MessageBox.Show("The directory does not contain images!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (capture != null && databaseFileName != null) { ObjectAnnotater form = null; //try { form = new ObjectAnnotater(capture, databaseFileName); Application.Run(form); } /*catch (Exception) { var fInfo = new FileInfo(databaseFileName); var autosaveName = fInfo.Name.Replace(fInfo.Extension, String.Empty) + "-autosave" + fInfo.Extension; autosaveName = Path.Combine(fInfo.DirectoryName, autosaveName); form.Database.Save(autosaveName); var msg = "Unfortunately not your fault :/" + "\r\n" + "However your work is successfully saved to:" + "\r\n" + autosaveName; MessageBox.Show(msg, "Fatal error", MessageBoxButtons.OK, MessageBoxIcon.Error); }*/ } capture.Close(); }
public CaptureDemo() { InitializeComponent(); pictureBox.SizeMode = PictureBoxSizeMode.Zoom; //reader = new CameraCapture(0); //capture from camera //reader = new FileCapture(Path.Combine(getResourceDir(), "Welcome Accord.NET Extensions.mp4")); //capture from video reader = new ImageDirectoryReader(Path.Combine(getResourceDir(), "Sequence"), "*.jpg"); reader.Open(); Application.Idle += capture_NewFrame; }
public CaptureDemo() { InitializeComponent(); pictureBox.SizeMode = PictureBoxSizeMode.Zoom; reader = new CameraCapture(0); //capture from camera (reader as CameraCapture).FrameSize = new Size(640, 480); //reader = new FileCapture(Path.Combine(getResourceDir(), "Welcome.mp4")); //capture from video //reader = new ImageDirectoryCapture(Path.Combine(getResourceDir(), "Sequence"), "*.jpg"); reader.Open(); Application.Idle += capture_NewFrame; }
public MainForm() { InitializeComponent(); this.picCamera.SizeMode = PictureBoxSizeMode.Zoom; this.picPortrait.SizeMode = PictureBoxSizeMode.Zoom; this.picCamera.Paint += picCamera_Paint; _reader = new CameraCapture(cameraIdx: 0); _reader.Open(); this.FormClosing += MainForm_FormClosing; Application.Idle += Application_Idle; this.btnCapture.Click += btnCapture_Click; this.btnSave.Click += btnSave_Click; }
public KLDemo() { InitializeComponent(); lkStorage = new PyrLKStorage <FlowColor>(pyrLevels: 1); try { #if FILE_CAPTURE string resourceDir = Path.Combine(Directory.GetParent(Directory.GetCurrentDirectory()).FullName, "Resources"); videoCapture = new ImageDirectoryReader(Path.Combine(resourceDir, "ImageSequence"), "*.jpg"); prevIm = videoCapture.ReadAs <FlowColor, float>(); oldPositions = prevIm. Convert <Gray, float>(). GoodFeaturesToTrack(winSize, 0.05f) .Select(x => new PointF(x.X, x.Y)).Take(100).ToList(); #else videoCapture = new CameraCapture(0); oldPositions = new List <PointF>(); prevIm = new Image <FlowColor, float>(imgSize); #endif } catch (Exception) { MessageBox.Show("Cannot find any camera!"); return; } if (videoCapture is CameraCapture) { (videoCapture as CameraCapture).FrameSize = imgSize; } this.FormClosing += CamshiftDemo_FormClosing; Application.Idle += videoCapture_NewFrame; videoCapture.Open(); }
public KLDemo() { InitializeComponent(); lkStorage = new PyrLKStorage<FlowColor>(pyrLevels: 1); try { #if FILE_CAPTURE string resourceDir = Path.Combine(Directory.GetParent(Directory.GetCurrentDirectory()).FullName, "Resources"); videoCapture = new ImageDirectoryReader(Path.Combine(resourceDir, "ImageSequence"), "*.jpg"); prevIm = videoCapture.ReadAs<FlowColor, float>(); oldPositions = prevIm. Convert<Gray, float>(). GoodFeaturesToTrack(winSize, 0.05f) .Select(x => new PointF(x.X, x.Y)).Take(100).ToList(); #else videoCapture = new CameraCapture(0); oldPositions = new List<PointF>(); prevIm = new Image<FlowColor, float>(imgSize); #endif } catch (Exception) { MessageBox.Show("Cannot find any camera!"); return; } if(videoCapture is CameraCapture) (videoCapture as CameraCapture).FrameSize = imgSize; this.FormClosing += CamshiftDemo_FormClosing; Application.Idle += videoCapture_NewFrame; videoCapture.Open(); }
public CamshiftDemo() { InitializeComponent(); bar_ValueChanged(null, null); //write values to variables init(); //create histograms try { #if FILE_CAPTURE string resourceDir = Path.Combine(Directory.GetParent(Directory.GetCurrentDirectory()).FullName, "Resources"); videoCapture = new ImageDirectoryReader(Path.Combine(resourceDir, "ImageSequence"), "*.jpg"); roi = new Rectangle(180, 285, 75, 120); isROISelected = true; this.barVMin.Value = 100; #else videoCapture = new CameraCapture(0); #endif } catch (Exception) { MessageBox.Show("Cannot find any camera!"); return; } if(videoCapture is CameraCapture) (videoCapture as CameraCapture).FrameSize = new Size(640, 480); //set new Size(0,0) for the lowest one this.FormClosing += CamshiftDemo_FormClosing; Application.Idle += videoCapture_InitFrame; videoCapture.Open(); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); ImageStreamReader capture = null; string databaseFileName = null; using (var wizard = new Wizard()) { wizard.ShowDialog(); capture = wizard.CaptureObj; databaseFileName = wizard.DatabaseFileName; }//*/ //capture = new ImageDirectoryReader(@"S:\Svjetla - baza podataka\prepared\prednja+straznja-svjetla-4\", "*.jpg"); //databaseFileName = @"S:\Svjetla - baza podataka\prepared\prednja+straznja-svjetla-4.xml";// if (capture == null && databaseFileName == null) //a user clicked "X" without data selection { return; } else if (databaseFileName == null) { MessageBox.Show("Capture or database file name is empty!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } capture.Open(); if (capture.Length == 0) { MessageBox.Show("The directory does not contain images!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (capture != null && databaseFileName != null) { AnnotaterForm form = null; try { form = new AnnotaterForm(capture, databaseFileName); Application.Run(form); } catch (Exception) { var fInfo = new FileInfo(databaseFileName); var autosaveName = fInfo.Name.Replace(fInfo.Extension, String.Empty) + "-autosave" + fInfo.Extension; autosaveName = Path.Combine(fInfo.DirectoryName, autosaveName); form.Database.Save(autosaveName); var msg = "Unfortunately not your fault :/" + "\r\n" + "However your work is successfully saved to:" + "\r\n" + autosaveName; MessageBox.Show(msg, "Fatal error", MessageBoxButtons.OK, MessageBoxIcon.Error); }//*/ } capture.Close(); }
public FastTPDemo() { InitializeComponent(); initialize(); try { #if FILE_CAPTURE string resourceDir = Path.Combine(Directory.GetParent(Directory.GetCurrentDirectory()).FullName, "Resources"); videoCapture = new ImageDirectoryCapture(Path.Combine(resourceDir, "ImageSequence"), "*.jpg"); #else videoCapture = new CameraCapture(0); #endif } catch (Exception ex) { MessageBox.Show(ex.Message); return; } if(videoCapture is CameraCapture) (videoCapture as CameraCapture).FrameSize = new Size(640 / 2, 480 / 2); //set new Size(0,0) for the lowest one this.FormClosing += FastTPDemo_FormClosing; Application.Idle += videoCapture_NewFrame; videoCapture.Open(); }