diff --git a/OpenCV/Form1.Designer.cs b/OpenCV/Form1.Designer.cs
index 1c6828f..5395342 100644
--- a/OpenCV/Form1.Designer.cs
+++ b/OpenCV/Form1.Designer.cs
@@ -30,7 +30,9 @@ namespace OpenCV
private void InitializeComponent()
{
this.pictureBoxIpl1 = new OpenCvSharp.UserInterface.PictureBoxIpl();
+ this.pictureBoxIpl2 = new OpenCvSharp.UserInterface.PictureBoxIpl();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxIpl1)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBoxIpl2)).BeginInit();
this.SuspendLayout();
//
// pictureBoxIpl1
@@ -42,17 +44,28 @@ namespace OpenCV
this.pictureBoxIpl1.TabIndex = 0;
this.pictureBoxIpl1.TabStop = false;
//
+ // pictureBoxIpl2
+ //
+ this.pictureBoxIpl2.Location = new System.Drawing.Point(658, 11);
+ this.pictureBoxIpl2.Name = "pictureBoxIpl2";
+ this.pictureBoxIpl2.Size = new System.Drawing.Size(640, 480);
+ this.pictureBoxIpl2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
+ this.pictureBoxIpl2.TabIndex = 1;
+ this.pictureBoxIpl2.TabStop = false;
+ //
// 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.ClientSize = new System.Drawing.Size(1302, 503);
+ this.Controls.Add(this.pictureBoxIpl2);
this.Controls.Add(this.pictureBoxIpl1);
this.Name = "Form1";
this.Text = "Form1";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBoxIpl1)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBoxIpl2)).EndInit();
this.ResumeLayout(false);
}
@@ -60,6 +73,7 @@ namespace OpenCV
#endregion
private OpenCvSharp.UserInterface.PictureBoxIpl pictureBoxIpl1;
+ private OpenCvSharp.UserInterface.PictureBoxIpl pictureBoxIpl2;
}
}
diff --git a/OpenCV/Form1.cs b/OpenCV/Form1.cs
index 690eaff..4930c31 100644
--- a/OpenCV/Form1.cs
+++ b/OpenCV/Form1.cs
@@ -36,7 +36,10 @@ namespace OpenCV
return;
src = new IplImage(fileName);
+ OpenCVClass Converter = new OpenCVClass();
+
pictureBoxIpl1.ImageIpl = src;
+ pictureBoxIpl2.ImageIpl = Converter.GrayScale(src);
}
catch (Exception ex)
{
diff --git a/OpenCV/OpenCV.csproj b/OpenCV/OpenCV.csproj
index 4981139..ddf0637 100644
--- a/OpenCV/OpenCV.csproj
+++ b/OpenCV/OpenCV.csproj
@@ -72,6 +72,7 @@
Form1.cs
+
diff --git a/OpenCV/OpenCVClass.cs b/OpenCV/OpenCVClass.cs
new file mode 100644
index 0000000..631d08b
--- /dev/null
+++ b/OpenCV/OpenCVClass.cs
@@ -0,0 +1,23 @@
+using OpenCvSharp;
+using System;
+
+namespace OpenCV
+{
+ class OpenCVClass : IDisposable
+ {
+ IplImage gray;
+
+ public IplImage GrayScale(IplImage src)
+ {
+ gray = new IplImage(src.Size, BitDepth.U8, 1);
+ Cv.CvtColor(src, gray, ColorConversion.BgrToGray);
+ return gray;
+ }
+
+ public void Dispose()
+ {
+ if (gray != null)
+ Cv.ReleaseImage(gray);
+ }
+ }
+}