master
syneffort 12 months ago
parent dc4b824fd4
commit 1c75897ad5
  1. 1
      OpenCV/Form1.cs
  2. 95
      OpenCV/Forms/CVDialog.Designer.cs
  3. 34
      OpenCV/Forms/CVDialog.cs
  4. 120
      OpenCV/Forms/CVDialog.resx
  5. 60
      OpenCV/Forms/MainForm.Designer.cs
  6. 48
      OpenCV/Forms/MainForm.cs
  7. 120
      OpenCV/Forms/MainForm.resx
  8. BIN
      OpenCV/Libs/OpenCvSharp.Blob.dll
  9. 4
      OpenCV/Libs/OpenCvSharp.Blob.dll.config
  10. 1285
      OpenCV/Libs/OpenCvSharp.Blob.xml
  11. BIN
      OpenCV/Libs/OpenCvSharp.CPlusPlus.dll
  12. 4
      OpenCV/Libs/OpenCvSharp.CPlusPlus.dll.config
  13. 34282
      OpenCV/Libs/OpenCvSharp.CPlusPlus.xml
  14. BIN
      OpenCV/Libs/OpenCvSharp.Extensions.dll
  15. 474
      OpenCV/Libs/OpenCvSharp.Extensions.xml
  16. BIN
      OpenCV/Libs/OpenCvSharp.UserInterface.dll
  17. BIN
      OpenCV/Libs/OpenCvSharp.dll
  18. 21
      OpenCV/Libs/OpenCvSharp.dll.config
  19. 33730
      OpenCV/Libs/OpenCvSharp.xml
  20. 39
      OpenCV/OpenCV.csproj
  21. 22
      OpenCV/OpenCV/Canny.cs
  22. 291
      OpenCV/OpenCV/OpenCVClass.cs
  23. 290
      OpenCV/OpenCVClass.cs
  24. 5
      OpenCV/Program.cs

@ -1,5 +1,6 @@
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
using OpenCV.OpenCV;
using OpenCvSharp; using OpenCvSharp;
namespace OpenCV namespace OpenCV

@ -0,0 +1,95 @@
namespace OpenCV.Forms
{
partial class CVDialog
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.picSource = new OpenCvSharp.UserInterface.PictureBoxIpl();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.picConverted = new OpenCvSharp.UserInterface.PictureBoxIpl();
((System.ComponentModel.ISupportInitialize)(this.picSource)).BeginInit();
this.tableLayoutPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picConverted)).BeginInit();
this.SuspendLayout();
//
// picSource
//
this.picSource.Dock = System.Windows.Forms.DockStyle.Fill;
this.picSource.Location = new System.Drawing.Point(3, 3);
this.picSource.Name = "picSource";
this.picSource.Size = new System.Drawing.Size(381, 419);
this.picSource.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.picSource.TabIndex = 0;
this.picSource.TabStop = false;
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 2;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Controls.Add(this.picSource, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.picConverted, 1, 0);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 1;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(774, 425);
this.tableLayoutPanel1.TabIndex = 1;
//
// picConverted
//
this.picConverted.Dock = System.Windows.Forms.DockStyle.Fill;
this.picConverted.Location = new System.Drawing.Point(390, 3);
this.picConverted.Name = "picConverted";
this.picConverted.Size = new System.Drawing.Size(381, 419);
this.picConverted.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.picConverted.TabIndex = 0;
this.picConverted.TabStop = false;
//
// CVDialog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(774, 425);
this.Controls.Add(this.tableLayoutPanel1);
this.Name = "CVDialog";
this.Text = "CVDialog";
((System.ComponentModel.ISupportInitialize)(this.picSource)).EndInit();
this.tableLayoutPanel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.picConverted)).EndInit();
this.ResumeLayout(false);
}
#endregion
private OpenCvSharp.UserInterface.PictureBoxIpl picSource;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private OpenCvSharp.UserInterface.PictureBoxIpl picConverted;
}
}

@ -0,0 +1,34 @@
using OpenCvSharp;
using OpenCvSharp.UserInterface;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OpenCV.Forms
{
public partial class CVDialog : Form
{
public IplImage Source
{
get { return picSource.ImageIpl; }
set { picSource.ImageIpl = value; }
}
public IplImage Converted
{
get { return picConverted.ImageIpl; }
set { picConverted.ImageIpl = value; }
}
public CVDialog()
{
InitializeComponent();
}
}
}

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

@ -0,0 +1,60 @@
namespace OpenCV.Forms
{
partial class MainForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnCanny = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// btnCanny
//
this.btnCanny.Location = new System.Drawing.Point(13, 13);
this.btnCanny.Name = "btnCanny";
this.btnCanny.Size = new System.Drawing.Size(75, 23);
this.btnCanny.TabIndex = 0;
this.btnCanny.Text = "Canny";
this.btnCanny.UseVisualStyleBackColor = true;
this.btnCanny.Click += new System.EventHandler(this.btnCanny_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.btnCanny);
this.Name = "MainForm";
this.Text = "MainForm";
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button btnCanny;
}
}

@ -0,0 +1,48 @@
using OpenCV.OpenCV;
using OpenCvSharp;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OpenCV.Forms
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
}
private IplImage GetImage()
{
OpenFileDialog dlg = new OpenFileDialog();
if (dlg.ShowDialog() != DialogResult.OK)
return null;
return new IplImage(dlg.FileName);
}
private void btnCanny_Click(object sender, EventArgs e)
{
IplImage src = GetImage();
if (src == null)
return;
OpenCVClass converter = new OpenCVClass();
IplImage converted = converter.CannyEdge(src);
CVDialog dlg = new CVDialog();
dlg.Source = src;
dlg.Converted = converted;
dlg.ShowDialog();
converter.Dispose();
}
}
}

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

Binary file not shown.

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<dllmap dll="OpenCvSharpExtern" target="libOpenCvSharpExtern.so" />
</configuration>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<dllmap dll="OpenCvSharpExtern" target="libOpenCvSharpExtern.so" />
</configuration>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,474 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>OpenCvSharp.Extensions</name>
</assembly>
<members>
<member name="T:OpenCvSharp.Extensions.Binarizer">
<summary>
Various binarization methods (ATTENTION : The methods of this class is not implemented in OpenCV)
</summary>
</member>
<member name="M:OpenCvSharp.Extensions.Binarizer.Niblack(OpenCvSharp.IplImage,OpenCvSharp.IplImage,System.Int32,System.Double)">
<summary>
Binarizes by Niblack's method
</summary>
<param name="src">Input image</param>
<param name="dst">Output image</param>
<param name="kernelSize">Window size</param>
<param name="k">Adequate coefficient</param>
</member>
<member name="M:OpenCvSharp.Extensions.Binarizer.NiblackFast(OpenCvSharp.IplImage,OpenCvSharp.IplImage,System.Int32,System.Double)">
<summary>
Binarizes by Niblack's method (This is faster but memory-hogging)
</summary>
<param name="src">Input image</param>
<param name="dst">Output image</param>
<param name="kernelSize">Window size</param>
<param name="k">Adequate coefficient</param>
</member>
<member name="M:OpenCvSharp.Extensions.Binarizer.Sauvola(OpenCvSharp.IplImage,OpenCvSharp.IplImage,System.Int32,System.Double,System.Double)">
<summary>
Binarizes by Sauvola's method
</summary>
<param name="src">Input image</param>
<param name="dst">Output image</param>
<param name="kernelSize">Window size</param>
<param name="k">Adequate coefficient</param>
<param name="r">Adequate coefficient</param>
</member>
<member name="M:OpenCvSharp.Extensions.Binarizer.SauvolaFast(OpenCvSharp.IplImage,OpenCvSharp.IplImage,System.Int32,System.Double,System.Double)">
<summary>
Binarizes by Sauvola's method (This is faster but memory-hogging)
</summary>
<param name="src">Input image</param>
<param name="dst">Output image</param>
<param name="kernelSize">Window size</param>
<param name="k">Adequate coefficient</param>
<param name="r">Adequate coefficient</param>
</member>
<member name="M:OpenCvSharp.Extensions.Binarizer.Bernsen(OpenCvSharp.IplImage,OpenCvSharp.IplImage,System.Int32,System.Byte,System.Byte)">
<summary>
Binarizes by Bernsen's method
</summary>
<param name="src">Input image</param>
<param name="dst">Output image</param>
<param name="kernelSize">Window size</param>
<param name="constrastMin">Adequate coefficient</param>
<param name="bgThreshold">Adequate coefficient</param>
</member>
<member name="M:OpenCvSharp.Extensions.Binarizer.Nick(OpenCvSharp.IplImage,OpenCvSharp.IplImage,System.Int32,System.Double)">
<summary>
Binarizes by Nick's method
</summary>
<param name="src">Input image</param>
<param name="dst">Output image</param>
<param name="kernelSize">Window size</param>
<param name="k">Adequate coefficient</param>
</member>
<member name="M:OpenCvSharp.Extensions.Binarizer.MeanStddev(OpenCvSharp.IplImage,System.Int32,System.Int32,System.Int32,System.Double@,System.Double@)">
<summary>
注目画素の周辺画素の平均値と標準偏差を求める
</summary>
<param name="img">画像の画素データ</param>
<param name="x">x座標</param>
<param name="y">y座標</param>
<param name="size">周辺画素の探索サイズ。奇数でなければならない</param>
<param name="mean">出力される平均</param>
<param name="stddev">出力される標準偏差</param>
</member>
<member name="M:OpenCvSharp.Extensions.Binarizer.MinMax(OpenCvSharp.IplImage,System.Int32,System.Int32,System.Int32,System.Byte@,System.Byte@)">
<summary>
注目画素の周辺画素の最大値と最小値を求める
</summary>
<param name="img">画像の画素データ</param>
<param name="x">x座標</param>
<param name="y">y座標</param>
<param name="size">周辺画素の探索サイズ。奇数でなければならない</param>
<param name="min">出力される最小値</param>
<param name="max">出力される最大値</param>
</member>
<member name="T:OpenCvSharp.Extensions.BitmapConverter">
<summary>
static class which provides conversion between System.Drawing.Bitmap and IplImage/Mat
</summary>
</member>
<member name="M:OpenCvSharp.Extensions.BitmapConverter.ToIplImage(System.Drawing.Bitmap)">
<summary>
Converts System.Drawing.Bitmap to IplImage
</summary>
<param name="src">System.Drawing.Bitmap object to be converted</param>
<returns>An IplImage object which is converted from System.Drawing.Bitmap</returns>
</member>
<member name="M:OpenCvSharp.Extensions.BitmapConverter.ToIplImage(System.Drawing.Bitmap,OpenCvSharp.IplImage)">
<summary>
Converts System.Drawing.Bitmap to IplImage
</summary>
<param name="src">System.Drawing.Bitmap object to be converted</param>
<param name="dst">An IplImage object which is converted from System.Drawing.Bitmap</param>
</member>
<member name="M:OpenCvSharp.Extensions.BitmapConverter.CopyFrom(OpenCvSharp.IplImage,System.Drawing.Bitmap)">
<summary>
Copies pixel data from System.Drawing.Bitmap to IplImage instance
</summary>
<param name="ipl"></param>
<param name="bitmap"></param>
<returns></returns>
</member>
<member name="M:OpenCvSharp.Extensions.BitmapConverter.ToBitmap(OpenCvSharp.IplImage)">
<summary>
Converts IplImage to System.Drawing.Bitmap
</summary>
<param name="src">Mat</param>
<returns></returns>
</member>
<member name="M:OpenCvSharp.Extensions.BitmapConverter.ToBitmap(OpenCvSharp.IplImage,System.Drawing.Imaging.PixelFormat)">
<summary>
Converts IplImage to System.Drawing.Bitmap
</summary>
<param name="src">Mat</param>
<param name="pf">Pixel Depth</param>
<returns></returns>
</member>
<member name="M:OpenCvSharp.Extensions.BitmapConverter.ToBitmap(OpenCvSharp.IplImage,System.Drawing.Bitmap)">
<summary>
Converts IplImage to System.Drawing.Bitmap
</summary>
<param name="src">Mat</param>
<param name="dst">IplImage</param>
<remarks>Author: shimat, Gummo (ROI support)</remarks>
</member>
<member name="M:OpenCvSharp.Extensions.BitmapConverter.DrawToHdc(OpenCvSharp.IplImage,System.IntPtr,OpenCvSharp.CvRect)">
<summary>
</summary>
<param name="img"></param>
<param name="hdc"></param>
<param name="dstRect"></param>
</member>
<member name="M:OpenCvSharp.Extensions.BitmapConverter.DrawToHdc(OpenCvSharp.IplImage,System.IntPtr,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32)">
<summary>
</summary>
<param name="img"></param>
<param name="hdc"></param>
<param name="x"></param>
<param name="y"></param>
<param name="w"></param>
<param name="h"></param>
<param name="fromX"></param>
<param name="fromY"></param>
</member>
<member name="M:OpenCvSharp.Extensions.BitmapConverter.DrawToGraphics(OpenCvSharp.IplImage,System.Drawing.Graphics,OpenCvSharp.CvRect)">
<summary>
</summary>
<param name="img"></param>
<param name="g"></param>
<param name="dstRect"></param>
</member>
<member name="M:OpenCvSharp.Extensions.BitmapConverter.DrawToGraphics(OpenCvSharp.IplImage,System.Drawing.Graphics,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32)">
<summary>
</summary>
<param name="img"></param>
<param name="g"></param>
<param name="x"></param>
<param name="y"></param>
<param name="w"></param>
<param name="h"></param>
<param name="fromX"></param>
<param name="fromY"></param>
</member>
<member name="M:OpenCvSharp.Extensions.BitmapConverter.ToMat(System.Drawing.Bitmap)">
<summary>
Converts System.Drawing.Bitmap to Mat
</summary>
<param name="src">System.Drawing.Bitmap object to be converted</param>
<returns>A Mat object which is converted from System.Drawing.Bitmap</returns>
</member>
<member name="M:OpenCvSharp.Extensions.BitmapConverter.ToMat(System.Drawing.Bitmap,OpenCvSharp.CPlusPlus.Mat)">
<summary>
Converts System.Drawing.Bitmap to Mat
</summary>
<param name="src">System.Drawing.Bitmap object to be converted</param>
<param name="dst">A Mat object which is converted from System.Drawing.Bitmap</param>
</member>
<member name="M:OpenCvSharp.Extensions.BitmapConverter.ToBitmap(OpenCvSharp.CPlusPlus.Mat)">
<summary>
Converts Mat to System.Drawing.Bitmap
</summary>
<param name="src">Mat</param>
<returns></returns>
</member>
<member name="M:OpenCvSharp.Extensions.BitmapConverter.ToBitmap(OpenCvSharp.CPlusPlus.Mat,System.Drawing.Imaging.PixelFormat)">
<summary>
Converts Mat to System.Drawing.Bitmap
</summary>
<param name="src">Mat</param>
<param name="pf">Pixel Depth</param>
<returns></returns>
</member>
<member name="M:OpenCvSharp.Extensions.BitmapConverter.ToBitmap(OpenCvSharp.CPlusPlus.Mat,System.Drawing.Bitmap)">
<summary>
Converts Mat to System.Drawing.Bitmap
</summary>
<param name="src">Mat</param>
<param name="dst">Mat</param>
<remarks>Author: shimat, Gummo (ROI support)</remarks>
</member>
<member name="T:OpenCvSharp.Extensions.CvExtensions">
<summary>
</summary>
</member>
<member name="M:OpenCvSharp.Extensions.CvExtensions.HoughLinesProbabilisticEx(OpenCvSharp.CvArr,System.Double,System.Double,System.Int32,System.Double,System.Double,System.Double,System.Double)">
<summary>
</summary>
<param name="img"></param>
<param name="rho"></param>
<param name="theta"></param>
<param name="threshold"></param>
<param name="minLineLength"></param>
<param name="maxLineGap"></param>
<param name="thetaMin"></param>
<param name="thetaMax"></param>
<returns></returns>
</member>
<member name="T:OpenCvSharp.Extensions.MyParallel">
<summary>
Task Parallel Library for .NET 2.0
</summary>
</member>
<member name="F:OpenCvSharp.Extensions.MyParallel.NumThread">
<summary>
Number of Threads
</summary>
</member>
<member name="M:OpenCvSharp.Extensions.MyParallel.For(System.Int32,System.Int32,System.Action{System.Int32})">
<summary>
Executes a for loop in which iterations may run in parallel.
</summary>
<param name="fromInclusive">The start index, inclusive.</param>
<param name="toExclusive">The end index, exclusive.</param>
<param name="body">The delegate that is invoked once per iteration.</param>
</member>
<member name="T:OpenCvSharp.Extensions.OS">
<summary>
</summary>
</member>
<member name="T:OpenCvSharp.Extensions.Runtime">
<summary>
</summary>
</member>
<member name="T:OpenCvSharp.Extensions.Platform">
<summary>
Provides information for the platform which the user is using
</summary>
</member>
<member name="F:OpenCvSharp.Extensions.Platform.OS">
<summary>
OS type
</summary>
</member>
<member name="F:OpenCvSharp.Extensions.Platform.Runtime">
<summary>
Runtime type
</summary>
</member>
<member name="T:OpenCvSharp.Extensions.WriteableBitmapConverter">
<summary>
A static class which provides conversion between System.Windows.Media.Imaging.WriteableBitmap and IplImage
</summary>
</member>
<member name="M:OpenCvSharp.Extensions.WriteableBitmapConverter.ToWriteableBitmap(OpenCvSharp.CPlusPlus.Mat,System.Double,System.Double,System.Windows.Media.PixelFormat,System.Windows.Media.Imaging.BitmapPalette)">
<summary>
Converts Mat to WriteableBitmap.
The arguments of this method corresponds the consructor of WriteableBitmap.
</summary>
<param name="src">Input Mat</param>
<param name="dpiX">Horizontal dots per inch</param>
<param name="dpiY">Vertical dots per inch</param>
<param name="pf">Pixel format of output WriteableBitmap</param>
<param name="bp">Bitmap pallette</param>
<returns>WriteableBitmap</returns>
</member>
<member name="M:OpenCvSharp.Extensions.WriteableBitmapConverter.ToWriteableBitmap(OpenCvSharp.CPlusPlus.Mat,System.Windows.Media.PixelFormat)">
<summary>
Converts Mat to WriteableBitmap (dpi=96, BitmapPalette=null)
</summary>
<param name="src">Input Mat</param>
<param name="pf">Pixel format of output WriteableBitmap</param>
<returns>WriteableBitmap</returns>
</member>
<member name="M:OpenCvSharp.Extensions.WriteableBitmapConverter.ToWriteableBitmap(OpenCvSharp.CPlusPlus.Mat)">
<summary>
Converts Mat to WriteableBitmap (dpi=96, BitmapPalette=null)
</summary>
<param name="src">Input Mat</param>
<returns>WriteableBitmap</returns>
</member>
<member name="M:OpenCvSharp.Extensions.WriteableBitmapConverter.ToWriteableBitmap(OpenCvSharp.CPlusPlus.Mat,System.Windows.Media.Imaging.WriteableBitmap)">
<summary>
Converts Mat to WriteableBitmap.
This method is more efficient because new instance of WriteableBitmap is not allocated.
</summary>
<param name="src">Input Mat</param>
<param name="dst">Output WriteableBitmap</param>
</member>
<member name="M:OpenCvSharp.Extensions.WriteableBitmapConverter.#cctor">
<summary>
</summary>
</member>
<member name="M:OpenCvSharp.Extensions.WriteableBitmapConverter.GetOptimumDepth(System.Windows.Media.PixelFormat)">
<summary>
指定したPixelFormatに適合するIplImageのビット深度を返す
</summary>
<param name="f"></param>
<returns></returns>
</member>
<member name="M:OpenCvSharp.Extensions.WriteableBitmapConverter.GetOptimumChannels(System.Windows.Media.PixelFormat)">
<summary>
指定したPixelFormatに適合するIplImageのチャンネル数を返す
</summary>
<param name="f"></param>
<returns></returns>
</member>
<member name="M:OpenCvSharp.Extensions.WriteableBitmapConverter.GetOptimumType(System.Windows.Media.PixelFormat)">
<summary>
指定したPixelFormatに適合するMatTypeを返す
</summary>
<param name="f"></param>
<returns></returns>
</member>
<member name="M:OpenCvSharp.Extensions.WriteableBitmapConverter.ToIplImage(System.Windows.Media.Imaging.WriteableBitmap)">
<summary>
Converts WriteableBitmap to IplImage
</summary>
<param name="src">Input WriteableBitmap</param>
<returns>IplImage</returns>
</member>
<member name="M:OpenCvSharp.Extensions.WriteableBitmapConverter.ToIplImage(System.Windows.Media.Imaging.WriteableBitmap,OpenCvSharp.IplImage)">
<summary>
Converts WriteableBitmap to IplImage
</summary>
<param name="src">Input WriteableBitmap</param>
<param name="dst">Output IplImage</param>
</member>
<member name="M:OpenCvSharp.Extensions.WriteableBitmapConverter.CopyFrom(OpenCvSharp.IplImage,System.Windows.Media.Imaging.WriteableBitmap)">
<summary>
Copies pixel data from System.Windows.Media.Imaging.WriteableBitmap to IplImage instance
</summary>
<param name="ipl"></param>
<param name="wb"></param>
<returns></returns>
</member>
<member name="M:OpenCvSharp.Extensions.WriteableBitmapConverter.GetOptimumPixelFormats(OpenCvSharp.BitDepth,System.Int32)">
<summary>
指定したIplImageのビット深度・チャンネル数に適合するPixelFormatを返す
</summary>
<param name="d"></param>
<param name="c"></param>
<returns></returns>
</member>
<member name="M:OpenCvSharp.Extensions.WriteableBitmapConverter.GetOptimumPixelFormats(OpenCvSharp.CPlusPlus.MatType)">
<summary>
指定したIplImageのビット深度・チャンネル数に適合するPixelFormatを返す
</summary>
<param name="type"></param>
<returns></returns>
</member>
<member name="M:OpenCvSharp.Extensions.WriteableBitmapConverter.ToWriteableBitmap(OpenCvSharp.IplImage,System.Double,System.Double,System.Windows.Media.PixelFormat,System.Windows.Media.Imaging.BitmapPalette)">
<summary>
Converts IplImage to WriteableBitmap.
The arguments of this method corresponds the consructor of WriteableBitmap.
</summary>
<param name="src">Input IplImage</param>
<param name="dpiX">Horizontal dots per inch</param>
<param name="dpiY">Vertical dots per inch</param>
<param name="pf">Pixel format of output WriteableBitmap</param>
<param name="bp">Bitmap pallette</param>
<returns>WriteableBitmap</returns>
</member>
<member name="M:OpenCvSharp.Extensions.WriteableBitmapConverter.ToWriteableBitmap(OpenCvSharp.IplImage,System.Windows.Media.PixelFormat)">
<summary>
Converts IplImage to WriteableBitmap (dpi=96, BitmapPalette=null)
</summary>
<param name="src">Input IplImage</param>
<param name="pf">Pixel format of output WriteableBitmap</param>
<returns>WriteableBitmap</returns>
</member>
<member name="M:OpenCvSharp.Extensions.WriteableBitmapConverter.ToWriteableBitmap(OpenCvSharp.IplImage)">
<summary>
Converts IplImage to WriteableBitmap (dpi=96, BitmapPalette=null)
</summary>
<param name="src">Input IplImage</param>
<returns>WriteableBitmap</returns>
</member>
<member name="M:OpenCvSharp.Extensions.WriteableBitmapConverter.ToWriteableBitmap(OpenCvSharp.IplImage,System.Windows.Media.Imaging.WriteableBitmap)">
<summary>
Converts IplImage to WriteableBitmap.
This method is more efficient because new instance of WriteableBitmap is not allocated.
</summary>
<param name="src">Input IplImage</param>
<param name="dst">Output WriteableBitmap</param>
</member>
<member name="T:OpenCvSharp.Extensions.BitmapSourceConverter">
<summary>
Static class which provides conversion between System.Windows.Media.Imaging.BitmapSource and IplImage
</summary>
</member>
<member name="M:OpenCvSharp.Extensions.BitmapSourceConverter.ToBitmapSource(OpenCvSharp.CPlusPlus.Mat)">
<summary>
Converts Mat to BitmapSource.
</summary>
<param name="src">Input IplImage</param>
<returns>BitmapSource</returns>
</member>
<member name="M:OpenCvSharp.Extensions.BitmapSourceConverter.ToBitmapSource(OpenCvSharp.CPlusPlus.Mat,System.Int32,System.Int32,System.Windows.Media.PixelFormat,System.Windows.Media.Imaging.BitmapPalette)">
<summary>
Converts Mat to BitmapSource.
</summary>
<param name="src">Input IplImage</param>
<param name="horizontalResolution"></param>
<param name="verticalResolution"></param>
<param name="pixelFormat"></param>
<param name="palette"></param>
<returns>BitmapSource</returns>
</member>
<member name="M:OpenCvSharp.Extensions.BitmapSourceConverter.ToBitmapSource(System.Drawing.Bitmap)">
<summary>
Converts System.Drawing.Bitmap to BitmapSource.
</summary>
<param name="src">Input System.Drawing.Bitmap</param>
<remarks>http://www.codeproject.com/Articles/104929/Bitmap-to-BitmapSource</remarks>
<returns>BitmapSource</returns>
</member>
<member name="M:OpenCvSharp.Extensions.BitmapSourceConverter.ToMat(System.Windows.Media.Imaging.BitmapSource)">
<summary>
Converts BitmapSource to Mat
</summary>
<param name="src">Input BitmapSource</param>
<returns>IplImage</returns>
</member>
<member name="M:OpenCvSharp.Extensions.BitmapSourceConverter.ToMat(System.Windows.Media.Imaging.BitmapSource,OpenCvSharp.CPlusPlus.Mat)">
<summary>
Converts BitmapSource to Mat
</summary>
<param name="src">Input BitmapSource</param>
<param name="dst">Output Mat</param>
</member>
<member name="M:OpenCvSharp.Extensions.BitmapSourceConverter.CopyFrom(OpenCvSharp.CPlusPlus.Mat,System.Windows.Media.Imaging.BitmapSource)">
<summary>
Copies pixel data from System.Windows.Media.Imaging.BitmapSource to IplImage instance
</summary>
<param name="mat"></param>
<param name="wb"></param>
<returns></returns>
</member>
</members>
</doc>

Binary file not shown.

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<dllmap os="!windows" dll="opencv_calib3d2410" target="libopencv_calib3d.so" />
<dllmap os="!windows" dll="opencv_contrib2410" target="libopencv_contrib.so" />
<dllmap os="!windows" dll="opencv_core2410" target="libopencv_core.so" />
<dllmap os="!windows" dll="opencv_features2d2410" target="libopencv_features2d.so" />
<dllmap os="!windows" dll="opencv_flann2410" target="libopencv_flann.so" />
<dllmap os="!windows" dll="opencv_gpu2410" target="libopencv_gpu.so" />
<dllmap os="!windows" dll="opencv_highgui2410" target="libopencv_highgui.so" />
<dllmap os="!windows" dll="opencv_imgproc2410" target="libopencv_imgproc.so" />
<dllmap os="!windows" dll="opencv_legacy2410" target="libopencv_legacy.so" />
<dllmap os="!windows" dll="opencv_ml2410" target="libopencv_ml.so" />
<dllmap os="!windows" dll="opencv_nonfree2410" target="libopencv_nonfree.so" />
<dllmap os="!windows" dll="opencv_objdetect2410" target="libopencv_objdetect.so" />
<dllmap os="!windows" dll="opencv_ocl2410" target="libopencv_ocl.so" />
<dllmap os="!windows" dll="opencv_photo2410" target="libopencv_photo.so" />
<dllmap os="!windows" dll="opencv_stitching2410" target="libopencv_stitching.so" />
<dllmap os="!windows" dll="opencv_superres2410" target="libopencv_superres.so" />
<dllmap os="!windows" dll="opencv_video2410" target="libopencv_video.so" />
<dllmap os="!windows" dll="opencv_videostab2410" target="libopencv_videostab.so" />
</configuration>

File diff suppressed because it is too large Load Diff

@ -35,23 +35,23 @@
<ItemGroup> <ItemGroup>
<Reference Include="OpenCvSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL"> <Reference Include="OpenCvSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>bin\Debug\OpenCvSharp.dll</HintPath> <HintPath>Libs\OpenCvSharp.dll</HintPath>
</Reference> </Reference>
<Reference Include="OpenCvSharp.Blob, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL"> <Reference Include="OpenCvSharp.Blob, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>bin\Debug\OpenCvSharp.Blob.dll</HintPath> <HintPath>Libs\OpenCvSharp.Blob.dll</HintPath>
</Reference> </Reference>
<Reference Include="OpenCvSharp.CPlusPlus, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL"> <Reference Include="OpenCvSharp.CPlusPlus, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>bin\Debug\OpenCvSharp.CPlusPlus.dll</HintPath> <HintPath>Libs\OpenCvSharp.CPlusPlus.dll</HintPath>
</Reference> </Reference>
<Reference Include="OpenCvSharp.Extensions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL"> <Reference Include="OpenCvSharp.Extensions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>bin\Debug\OpenCvSharp.Extensions.dll</HintPath> <HintPath>Libs\OpenCvSharp.Extensions.dll</HintPath>
</Reference> </Reference>
<Reference Include="OpenCvSharp.UserInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL"> <Reference Include="OpenCvSharp.UserInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>bin\Debug\OpenCvSharp.UserInterface.dll</HintPath> <HintPath>Libs\OpenCvSharp.UserInterface.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
@ -72,12 +72,31 @@
<Compile Include="Form1.Designer.cs"> <Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon> <DependentUpon>Form1.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="OpenCVClass.cs" /> <Compile Include="Forms\CVDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\CVDialog.Designer.cs">
<DependentUpon>CVDialog.cs</DependentUpon>
</Compile>
<Compile Include="Forms\MainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="OpenCV\Canny.cs" />
<Compile Include="OpenCV\OpenCVClass.cs" />
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx"> <EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon> <DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Forms\CVDialog.resx">
<DependentUpon>CVDialog.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx"> <EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
@ -100,5 +119,13 @@
<ItemGroup> <ItemGroup>
<None Include="App.config" /> <None Include="App.config" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Include="Libs\OpenCvSharp.Blob.dll" />
<Content Include="Libs\OpenCvSharp.CPlusPlus.dll" />
<Content Include="Libs\OpenCvSharp.dll" />
<Content Include="Libs\OpenCvSharp.Extensions.dll" />
<Content Include="Libs\OpenCvSharp.UserInterface.dll" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

@ -0,0 +1,22 @@
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 : IDisposable
{
IplImage _canny;
public IplImage CannyEdge(IplImage src)
{
_canny = new IplImage(src.Size, BitDepth.U8, 1);
Cv.Canny(src, _canny, 100, 255, ApertureSize.Size3);
return _canny;
}
}
}

@ -0,0 +1,291 @@
using OpenCvSharp;
using System;
namespace OpenCV.OpenCV
{
partial class OpenCVClass : IDisposable
{
IplImage _gray;
IplImage _inversion;
IplImage _bin;
IplImage _blur;
IplImage _zoomin;
IplImage _zoomout;
IplImage _resize;
IplImage _slice;
IplImage _symm;
IplImage _rotate;
IplImage _affine;
IplImage _perspective;
IplImage _draw;
IplImage _hsv;
IplImage _hsvRed;
IplImage _morp;
IplConvKernel _convKernel;
public IplImage GrayScale(IplImage src)
{
_gray = new IplImage(src.Size, BitDepth.U8, 1);
Cv.CvtColor(src, _gray, ColorConversion.BgrToGray);
return _gray;
}
public IplImage InversionImage(IplImage src)
{
_inversion = new IplImage(src.Size, BitDepth.U8, 3);
Cv.Not(src, _inversion);
return _inversion;
}
public IplImage Binary(IplImage src, int threshold)
{
_bin = GrayScale(src);
Cv.Threshold(_bin, _bin, threshold, 255, ThresholdType.Binary);
return _bin;
}
public IplImage Blur(IplImage src)
{
_blur = new IplImage(src.Size, BitDepth.U8, 3);
Cv.Smooth(src, _blur, SmoothType.Blur, 9); // param1은 홀수, 중간 픽셀 선택을 위함
return _blur;
}
public IplImage ZoomIn(IplImage src)
{
_zoomin = new IplImage(new CvSize(src.Width * 2, src.Height * 2) , BitDepth.U8, 3);
Cv.PyrUp(src, _zoomin, CvFilter.Gaussian5x5);
return _zoomin;
}
public IplImage ZoomOut(IplImage src)
{
_zoomout = new IplImage(new CvSize(src.Width / 2, src.Height / 2), BitDepth.U8, 3);
Cv.PyrDown(src, _zoomout, CvFilter.Gaussian5x5);
return _zoomout;
}
public IplImage Resize(IplImage src, double widthRate, double heightRate)
{
_resize = new IplImage(new CvSize((int)(src.Width * widthRate), (int)(src.Height * heightRate)), BitDepth.U8, 3);
Cv.Resize(src, _resize, Interpolation.Linear);
return _resize;
}
public IplImage Slice(IplImage src, int x, int y, int roiWidht, int roiHeight)
{
//slice = new IplImage(new CvSize(roiWidht, roiHeight), BitDepth.U8, 3);
//src.ROI = new CvRect(x, y, roiWidht, roiHeight);
//src.SetROI(new CvRect(x, y, roiWidht, roiHeight));
//Cv.SetImageROI(src, new CvRect(x, y, roiWidht, roiHeight));
//Cv.Copy(src, slice);
//Cv.Resize(src, slice);
//slice = src.Clone(); // 속성까지 복사되어 채널 등 값이 변경됨
//src.ResetROI();
//Cv.ResetImageROI(src);
CvRect roi = new CvRect(x, y, roiWidht, roiHeight);
_slice = src.Clone(roi);
return _slice;
}
public IplImage Symmetry(IplImage src, FlipMode mode)
{
_symm = new IplImage(src.Size, BitDepth.U8, 3);
Cv.Flip(src, _symm, mode);
return _symm;
}
public IplImage Rotate(IplImage src, double angle)
{
_rotate = new IplImage(src.Size, BitDepth.U8, 3);
CvMat matrix = Cv.GetRotationMatrix2D(new CvPoint2D32f(src.Width / 2, src.Height / 2), angle, 1);
Cv.WarpAffine(src, _rotate, matrix, Interpolation.Linear, CvScalar.ScalarAll(0));
return _rotate;
}
public IplImage AffineImage(IplImage src, CvPoint2D32f[] srcPoints, CvPoint2D32f[] dstPoints)
{
if (srcPoints.Length != 3 || dstPoints.Length != 3)
return null;
_affine = new IplImage(src.Size, BitDepth.U8, 3);
CvMat matrix = Cv.GetAffineTransform(srcPoints, dstPoints);
Cv.WarpAffine(src, _affine, matrix, Interpolation.Linear, CvScalar.RealScalar(0));
return _affine;
}
public IplImage PerspectiveImage(IplImage src, CvPoint2D32f[] srcPoints, CvPoint2D32f[] dstPoints)
{
if (srcPoints.Length != 4 || dstPoints.Length != 4)
return null;
_perspective = new IplImage(src.Size, BitDepth.U8, 3);
CvMat matrix = Cv.GetPerspectiveTransform(srcPoints, dstPoints);
Cv.WarpPerspective(src, _perspective, matrix, Interpolation.Linear, CvScalar.RealScalar(0));
return _perspective;
}
public IplImage DrawImage()
{
_draw = new IplImage(new CvSize(640, 480), BitDepth.U8, 3);
Cv.DrawLine(_draw, new CvPoint(100, 100), new CvPoint(500, 200), CvColor.Blue, 20);
Cv.DrawCircle(_draw, new CvPoint(200, 200), 50, CvColor.Red, -1);
Cv.DrawRect(_draw, new CvPoint(300, 150), new CvPoint(500, 300), CvColor.Green, 5);
Cv.DrawEllipse(_draw, new CvPoint(150, 400), new CvSize(100, 50), 0, 90, 360, CvColor.Green, -1);
Cv.PutText(_draw, "Open CV", new CvPoint(400, 400), new CvFont(FontFace.HersheyComplex, 1, 1), CvColor.White);
return _draw;
}
public IplImage HSV(IplImage src)
{
_hsv = new IplImage(src.Size, BitDepth.U8, 3);
IplImage h = new IplImage(src.Size, BitDepth.U8, 1);
IplImage s = new IplImage(src.Size, BitDepth.U8, 1);
IplImage v = new IplImage(src.Size, BitDepth.U8, 1);
Cv.CvtColor(src, _hsv, ColorConversion.BgrToHsv);
Cv.Split(_hsv, h, s, v, null);
_hsv.SetZero();
// Hue
//Cv.InRangeS(h, 20, 30, h); // Yellow
//Cv.Copy(src, hsv, h);
// Hue - Red
IplImage lowerRed = new IplImage(src.Size, BitDepth.U8, 1);
IplImage upperRed = new IplImage(src.Size, BitDepth.U8, 1);
IplImage red = new IplImage(src.Size, BitDepth.U8, 1);
Cv.InRangeS(h, 0, 10, lowerRed);
Cv.InRangeS(h, 170, 179, upperRed);
Cv.AddWeighted(lowerRed, 1.0, upperRed, 1.0, 0.0, red);
Cv.Copy(src, _hsv, red);
// Saturation
//Cv.InRangeS(s, 20, 30, s);
//Cv.Copy(src, hsv, s);
// Value
//Cv.InRangeS(v, 20, 30, v);
//Cv.Copy(src, hsv, v);
return _hsv;
}
public IplImage HSVRed(IplImage src)
{
_hsvRed = new IplImage(src.Size, BitDepth.U8, 3);
IplImage lowerRed = new IplImage(src.Size, BitDepth.U8, 1);
IplImage upperRed = new IplImage(src.Size, BitDepth.U8, 1);
IplImage red = new IplImage(src.Size, BitDepth.U8, 1);
Cv.CvtColor(src, _hsvRed, ColorConversion.BgrToHsv);
Cv.InRangeS(_hsvRed, new CvScalar(0, 100, 100), new CvScalar(10, 255, 255), lowerRed);
Cv.InRangeS(_hsvRed, new CvScalar(170, 100, 100), new CvScalar(179, 255, 255), upperRed);
Cv.AddWeighted(lowerRed, 1.0, upperRed, 1.0, 0.0, red);
_hsvRed.SetZero();
Cv.Copy(src, _hsvRed, red);
return _hsvRed;
}
private void Release(params IplImage[] images)
{
for (int i = 0; i < images.Length; i++)
{
if (images[i] != null)
Cv.ReleaseImage(images[i]);
}
}
public IplImage DilateImage(IplImage src, int threshold, int iteration)
{
_morp = new IplImage(src.Size, BitDepth.U8, 1);
_bin = Binary(src, threshold);
Cv.Dilate(_bin, _morp, _convKernel, iteration);
return _morp;
}
public IplImage ErodeImage(IplImage src, int threshold, int iteration)
{
_morp = new IplImage(src.Size, BitDepth.U8, 1);
_bin = Binary(src, threshold);
Cv.Erode(_bin, _morp, _convKernel, iteration);
return _morp;
}
public IplImage DEImage(IplImage src, int threshold, int iteration)
{
_morp = new IplImage(src.Size, BitDepth.U8, 1);
_bin = Binary(src, threshold);
Cv.Dilate(_bin, _morp, _convKernel, iteration);
Cv.Erode(_morp, _morp, _convKernel, iteration);
return _morp;
}
public IplImage EDImage(IplImage src, int threshold, int iteration)
{
_morp = new IplImage(src.Size, BitDepth.U8, 1);
_bin = Binary(src, threshold);
Cv.Erode(_bin, _morp, _convKernel, iteration);
Cv.Dilate(_morp, _morp, _convKernel, iteration);
return _morp;
}
public IplImage MorphologyImage(IplImage src, MorphologyOperation option, int iteration)
{
if (_convKernel == null)
return null;
_morp = new IplImage(src.Size, BitDepth.U8, 1);
_bin = Binary(src, 50);
Cv.MorphologyEx(_bin, _morp, _bin, _convKernel, option, iteration);
return _morp;
}
public virtual void Dispose()
{
Release(
_gray,
_inversion,
_bin,
_blur,
_zoomin,
_zoomout,
_resize,
_slice,
_symm,
_rotate,
_affine,
_perspective,
_draw,
_hsv,
_hsvRed,
_morp,
_canny
);
}
public IplConvKernel ConvKernel
{
get { return this._convKernel; }
set { this._convKernel = value; }
}
}
}

@ -1,290 +0,0 @@
using OpenCvSharp;
using System;
namespace OpenCV
{
class OpenCVClass : IDisposable
{
IplImage gray;
IplImage inversion;
IplImage bin;
IplImage blur;
IplImage zoomin;
IplImage zoomout;
IplImage resize;
IplImage slice;
IplImage symm;
IplImage rotate;
IplImage affine;
IplImage perspective;
IplImage draw;
IplImage hsv;
IplImage hsvRed;
IplImage morp;
IplConvKernel convKernel;
public IplImage GrayScale(IplImage src)
{
gray = new IplImage(src.Size, BitDepth.U8, 1);
Cv.CvtColor(src, gray, ColorConversion.BgrToGray);
return gray;
}
public IplImage InversionImage(IplImage src)
{
inversion = new IplImage(src.Size, BitDepth.U8, 3);
Cv.Not(src, inversion);
return inversion;
}
public IplImage Binary(IplImage src, int threshold)
{
bin = GrayScale(src);
Cv.Threshold(bin, bin, threshold, 255, ThresholdType.Binary);
return bin;
}
public IplImage Blur(IplImage src)
{
blur = new IplImage(src.Size, BitDepth.U8, 3);
Cv.Smooth(src, blur, SmoothType.Blur, 9); // param1은 홀수, 중간 픽셀 선택을 위함
return blur;
}
public IplImage ZoomIn(IplImage src)
{
zoomin = new IplImage(new CvSize(src.Width * 2, src.Height * 2) , BitDepth.U8, 3);
Cv.PyrUp(src, zoomin, CvFilter.Gaussian5x5);
return zoomin;
}
public IplImage ZoomOut(IplImage src)
{
zoomout = new IplImage(new CvSize(src.Width / 2, src.Height / 2), BitDepth.U8, 3);
Cv.PyrDown(src, zoomout, CvFilter.Gaussian5x5);
return zoomout;
}
public IplImage Resize(IplImage src, double widthRate, double heightRate)
{
resize = new IplImage(new CvSize((int)(src.Width * widthRate), (int)(src.Height * heightRate)), BitDepth.U8, 3);
Cv.Resize(src, resize, Interpolation.Linear);
return resize;
}
public IplImage Slice(IplImage src, int x, int y, int roiWidht, int roiHeight)
{
//slice = new IplImage(new CvSize(roiWidht, roiHeight), BitDepth.U8, 3);
//src.ROI = new CvRect(x, y, roiWidht, roiHeight);
//src.SetROI(new CvRect(x, y, roiWidht, roiHeight));
//Cv.SetImageROI(src, new CvRect(x, y, roiWidht, roiHeight));
//Cv.Copy(src, slice);
//Cv.Resize(src, slice);
//slice = src.Clone(); // 속성까지 복사되어 채널 등 값이 변경됨
//src.ResetROI();
//Cv.ResetImageROI(src);
CvRect roi = new CvRect(x, y, roiWidht, roiHeight);
slice = src.Clone(roi);
return slice;
}
public IplImage Symmetry(IplImage src, FlipMode mode)
{
symm = new IplImage(src.Size, BitDepth.U8, 3);
Cv.Flip(src, symm, mode);
return symm;
}
public IplImage Rotate(IplImage src, double angle)
{
rotate = new IplImage(src.Size, BitDepth.U8, 3);
CvMat matrix = Cv.GetRotationMatrix2D(new CvPoint2D32f(src.Width / 2, src.Height / 2), angle, 1);
Cv.WarpAffine(src, rotate, matrix, Interpolation.Linear, CvScalar.ScalarAll(0));
return rotate;
}
public IplImage AffineImage(IplImage src, CvPoint2D32f[] srcPoints, CvPoint2D32f[] dstPoints)
{
if (srcPoints.Length != 3 || dstPoints.Length != 3)
return null;
affine = new IplImage(src.Size, BitDepth.U8, 3);
CvMat matrix = Cv.GetAffineTransform(srcPoints, dstPoints);
Cv.WarpAffine(src, affine, matrix, Interpolation.Linear, CvScalar.RealScalar(0));
return affine;
}
public IplImage PerspectiveImage(IplImage src, CvPoint2D32f[] srcPoints, CvPoint2D32f[] dstPoints)
{
if (srcPoints.Length != 4 || dstPoints.Length != 4)
return null;
perspective = new IplImage(src.Size, BitDepth.U8, 3);
CvMat matrix = Cv.GetPerspectiveTransform(srcPoints, dstPoints);
Cv.WarpPerspective(src, perspective, matrix, Interpolation.Linear, CvScalar.RealScalar(0));
return perspective;
}
public IplImage DrawImage()
{
draw = new IplImage(new CvSize(640, 480), BitDepth.U8, 3);
Cv.DrawLine(draw, new CvPoint(100, 100), new CvPoint(500, 200), CvColor.Blue, 20);
Cv.DrawCircle(draw, new CvPoint(200, 200), 50, CvColor.Red, -1);
Cv.DrawRect(draw, new CvPoint(300, 150), new CvPoint(500, 300), CvColor.Green, 5);
Cv.DrawEllipse(draw, new CvPoint(150, 400), new CvSize(100, 50), 0, 90, 360, CvColor.Green, -1);
Cv.PutText(draw, "Open CV", new CvPoint(400, 400), new CvFont(FontFace.HersheyComplex, 1, 1), CvColor.White);
return draw;
}
public IplImage HSV(IplImage src)
{
hsv = new IplImage(src.Size, BitDepth.U8, 3);
IplImage h = new IplImage(src.Size, BitDepth.U8, 1);
IplImage s = new IplImage(src.Size, BitDepth.U8, 1);
IplImage v = new IplImage(src.Size, BitDepth.U8, 1);
Cv.CvtColor(src, hsv, ColorConversion.BgrToHsv);
Cv.Split(hsv, h, s, v, null);
hsv.SetZero();
// Hue
//Cv.InRangeS(h, 20, 30, h); // Yellow
//Cv.Copy(src, hsv, h);
// Hue - Red
IplImage lowerRed = new IplImage(src.Size, BitDepth.U8, 1);
IplImage upperRed = new IplImage(src.Size, BitDepth.U8, 1);
IplImage red = new IplImage(src.Size, BitDepth.U8, 1);
Cv.InRangeS(h, 0, 10, lowerRed);
Cv.InRangeS(h, 170, 179, upperRed);
Cv.AddWeighted(lowerRed, 1.0, upperRed, 1.0, 0.0, red);
Cv.Copy(src, hsv, red);
// Saturation
//Cv.InRangeS(s, 20, 30, s);
//Cv.Copy(src, hsv, s);
// Value
//Cv.InRangeS(v, 20, 30, v);
//Cv.Copy(src, hsv, v);
return hsv;
}
public IplImage HSVRed(IplImage src)
{
hsvRed = new IplImage(src.Size, BitDepth.U8, 3);
IplImage lowerRed = new IplImage(src.Size, BitDepth.U8, 1);
IplImage upperRed = new IplImage(src.Size, BitDepth.U8, 1);
IplImage red = new IplImage(src.Size, BitDepth.U8, 1);
Cv.CvtColor(src, hsvRed, ColorConversion.BgrToHsv);
Cv.InRangeS(hsvRed, new CvScalar(0, 100, 100), new CvScalar(10, 255, 255), lowerRed);
Cv.InRangeS(hsvRed, new CvScalar(170, 100, 100), new CvScalar(179, 255, 255), upperRed);
Cv.AddWeighted(lowerRed, 1.0, upperRed, 1.0, 0.0, red);
hsvRed.SetZero();
Cv.Copy(src, hsvRed, red);
return hsvRed;
}
private void Release(params IplImage[] images)
{
for (int i = 0; i < images.Length; i++)
{
if (images[i] != null)
Cv.ReleaseImage(images[i]);
}
}
public IplImage DilateImage(IplImage src, int threshold, int iteration)
{
morp = new IplImage(src.Size, BitDepth.U8, 1);
bin = Binary(src, threshold);
Cv.Dilate(bin, morp, convKernel, iteration);
return morp;
}
public IplImage ErodeImage(IplImage src, int threshold, int iteration)
{
morp = new IplImage(src.Size, BitDepth.U8, 1);
bin = Binary(src, threshold);
Cv.Erode(bin, morp, convKernel, iteration);
return morp;
}
public IplImage DEImage(IplImage src, int threshold, int iteration)
{
morp = new IplImage(src.Size, BitDepth.U8, 1);
bin = Binary(src, threshold);
Cv.Dilate(bin, morp, convKernel, iteration);
Cv.Erode(morp, morp, convKernel, iteration);
return morp;
}
public IplImage EDImage(IplImage src, int threshold, int iteration)
{
morp = new IplImage(src.Size, BitDepth.U8, 1);
bin = Binary(src, threshold);
Cv.Erode(bin, morp, convKernel, iteration);
Cv.Dilate(morp, morp, convKernel, iteration);
return morp;
}
public IplImage MorphologyImage(IplImage src, MorphologyOperation option, int iteration)
{
if (convKernel == null)
return null;
morp = new IplImage(src.Size, BitDepth.U8, 1);
bin = Binary(src, 50);
Cv.MorphologyEx(bin, morp, bin, convKernel, option, iteration);
return morp;
}
public void Dispose()
{
Release(
gray,
inversion,
bin,
blur,
zoomin,
zoomout,
resize,
slice,
symm,
rotate,
affine,
perspective,
draw,
hsv,
hsvRed,
morp
);
}
public IplConvKernel ConvKernel
{
get { return this.convKernel; }
set { this.convKernel = value; }
}
}
}

@ -1,4 +1,5 @@
using System; using OpenCV.Forms;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -16,7 +17,7 @@ namespace OpenCV
{ {
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1()); Application.Run(new MainForm());
} }
} }
} }

Loading…
Cancel
Save