diff --git a/OpenCV/Forms/MainForm.Designer.cs b/OpenCV/Forms/MainForm.Designer.cs
index 20455a2..84d3cf6 100644
--- a/OpenCV/Forms/MainForm.Designer.cs
+++ b/OpenCV/Forms/MainForm.Designer.cs
@@ -34,6 +34,7 @@
this.btnContour = new System.Windows.Forms.Button();
this.btnScanContour = new System.Windows.Forms.Button();
this.btnTest = new System.Windows.Forms.Button();
+ this.btnG2Track = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// btnCanny
@@ -96,11 +97,22 @@
this.btnTest.UseVisualStyleBackColor = true;
this.btnTest.Click += new System.EventHandler(this.btnTest_Click);
//
+ // btnG2Track
+ //
+ this.btnG2Track.Location = new System.Drawing.Point(122, 71);
+ this.btnG2Track.Name = "btnG2Track";
+ this.btnG2Track.Size = new System.Drawing.Size(102, 23);
+ this.btnG2Track.TabIndex = 0;
+ this.btnG2Track.Text = "Corner -G2T";
+ this.btnG2Track.UseVisualStyleBackColor = true;
+ this.btnG2Track.Click += new System.EventHandler(this.btnG2Track_Click);
+ //
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(470, 365);
+ this.Controls.Add(this.btnG2Track);
this.Controls.Add(this.btnScanContour);
this.Controls.Add(this.btnContour);
this.Controls.Add(this.btnTest);
@@ -121,5 +133,6 @@
private System.Windows.Forms.Button btnContour;
private System.Windows.Forms.Button btnScanContour;
private System.Windows.Forms.Button btnTest;
+ private System.Windows.Forms.Button btnG2Track;
}
}
\ No newline at end of file
diff --git a/OpenCV/Forms/MainForm.cs b/OpenCV/Forms/MainForm.cs
index 7bff73f..4dd5794 100644
--- a/OpenCV/Forms/MainForm.cs
+++ b/OpenCV/Forms/MainForm.cs
@@ -131,5 +131,22 @@ namespace OpenCV.Forms
converter.Dispose();
}
+
+ private void btnG2Track_Click(object sender, EventArgs e)
+ {
+ IplImage src = GetImage();
+ if (src == null)
+ return;
+
+ OpenCVClass converter = new OpenCVClass();
+ IplImage converted = converter.GoodFeaturesToTrack(src);
+
+ CVDialog dlg = new CVDialog();
+ dlg.Source = src;
+ dlg.Converted = converted;
+ dlg.ShowDialog();
+
+ converter.Dispose();
+ }
}
}
diff --git a/OpenCV/OpenCV.csproj b/OpenCV/OpenCV.csproj
index c1579e6..2ebd1f9 100644
--- a/OpenCV/OpenCV.csproj
+++ b/OpenCV/OpenCV.csproj
@@ -91,6 +91,7 @@
MainForm.cs
+
diff --git a/OpenCV/OpenCV/Corner.cs b/OpenCV/OpenCV/Corner.cs
new file mode 100644
index 0000000..76c84f2
--- /dev/null
+++ b/OpenCV/OpenCV/Corner.cs
@@ -0,0 +1,34 @@
+using OpenCvSharp;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OpenCV.OpenCV
+{
+ internal partial class OpenCVClass
+ {
+ public IplImage GoodFeaturesToTrack(IplImage src)
+ {
+ _cvt = new IplImage(src.Size, BitDepth.U8, 3);
+ IplImage eigImage = new IplImage(src.Size, BitDepth.U8, 1);
+ IplImage tempImage = new IplImage(src.Size, BitDepth.U8, 1);
+
+ Cv.Copy(src, _cvt);
+ _gray = GrayScale(src);
+
+ CvPoint2D32f[] corners;
+ int cornerCount = 150;
+
+ Cv.GoodFeaturesToTrack(_gray, eigImage, tempImage, out corners, ref cornerCount, 0.01, 5);
+
+ for (int i = 0; i < cornerCount; i++)
+ {
+ Cv.DrawCircle(_cvt, corners[i], 3, CvColor.Red, 1);
+ }
+
+ return _cvt;
+ }
+ }
+}