diff --git a/OpenCV/Form1.Designer.cs b/OpenCV/Form1.Designer.cs
index ec25b03..1c6828f 100644
--- a/OpenCV/Form1.Designer.cs
+++ b/OpenCV/Form1.Designer.cs
@@ -29,10 +29,7 @@ namespace OpenCV
///
private void InitializeComponent()
{
- this.components = new System.ComponentModel.Container();
this.pictureBoxIpl1 = new OpenCvSharp.UserInterface.PictureBoxIpl();
- this.timer1 = new System.Windows.Forms.Timer(this.components);
- this.label1 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxIpl1)).BeginInit();
this.SuspendLayout();
//
@@ -45,26 +42,11 @@ namespace OpenCV
this.pictureBoxIpl1.TabIndex = 0;
this.pictureBoxIpl1.TabStop = false;
//
- // timer1
- //
- this.timer1.Interval = 33;
- this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(20, 20);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(38, 12);
- this.label1.TabIndex = 1;
- this.label1.Text = "label1";
- //
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(662, 503);
- this.Controls.Add(this.label1);
this.Controls.Add(this.pictureBoxIpl1);
this.Name = "Form1";
this.Text = "Form1";
@@ -72,15 +54,12 @@ namespace OpenCV
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBoxIpl1)).EndInit();
this.ResumeLayout(false);
- this.PerformLayout();
}
#endregion
private OpenCvSharp.UserInterface.PictureBoxIpl pictureBoxIpl1;
- private System.Windows.Forms.Timer timer1;
- private System.Windows.Forms.Label label1;
}
}
diff --git a/OpenCV/Form1.cs b/OpenCV/Form1.cs
index a5808cd..690eaff 100644
--- a/OpenCV/Form1.cs
+++ b/OpenCV/Form1.cs
@@ -6,11 +6,9 @@ namespace OpenCV
{
public partial class Form1 : Form
{
- CvCapture capture;
IplImage src;
- string filePath;
- int frameCount = 0;
+ string fileName;
public Form1()
{
@@ -33,37 +31,19 @@ namespace OpenCV
{
try
{
- //capture = CvCapture.FromCamera(CaptureDevice.DShow, 0);
- //capture.SetCaptureProperty(CaptureProperty.FrameWidth, 640);
- //capture.SetCaptureProperty(CaptureProperty.FrameHeight, 480);
- filePath = FindFileName();
- if (String.IsNullOrEmpty(filePath))
+ fileName = FindFileName();
+ if (String.IsNullOrEmpty(fileName))
return;
- capture = CvCapture.FromFile(filePath);
- timer1.Enabled = true;
+ src = new IplImage(fileName);
+ pictureBoxIpl1.ImageIpl = src;
}
catch (Exception ex)
{
- timer1.Enabled = false;
MessageBox.Show(ex.Message);
}
}
- private void timer1_Tick(object sender, EventArgs e)
- {
- frameCount++;
- label1.Text = $"Frame: {frameCount} / {capture.FrameCount}";
- src = capture.QueryFrame();
- if (frameCount == capture.FrameCount)
- {
- frameCount = 0;
- capture = CvCapture.FromFile(filePath);
- }
-
- pictureBoxIpl1.ImageIpl = src;
- }
-
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
Cv.ReleaseImage(src);
diff --git a/OpenCV/Form1.resx b/OpenCV/Form1.resx
index 1f666f2..1af7de1 100644
--- a/OpenCV/Form1.resx
+++ b/OpenCV/Form1.resx
@@ -117,7 +117,4 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- 17, 17
-
\ No newline at end of file