diff --git a/OpenCV.sln b/OpenCV.sln new file mode 100644 index 0000000..51c5d04 --- /dev/null +++ b/OpenCV.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31005.135 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenCV", "OpenCV\OpenCV.csproj", "{CE52DE2F-2E50-4FC9-96E2-F02D0E205EFC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CE52DE2F-2E50-4FC9-96E2-F02D0E205EFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CE52DE2F-2E50-4FC9-96E2-F02D0E205EFC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CE52DE2F-2E50-4FC9-96E2-F02D0E205EFC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CE52DE2F-2E50-4FC9-96E2-F02D0E205EFC}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C41C63F8-65C5-4BC3-9ABB-BFA262560B09} + EndGlobalSection +EndGlobal diff --git a/OpenCV/App.config b/OpenCV/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/OpenCV/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/OpenCV/Form1.Designer.cs b/OpenCV/Form1.Designer.cs new file mode 100644 index 0000000..b2bc072 --- /dev/null +++ b/OpenCV/Form1.Designer.cs @@ -0,0 +1,73 @@ + +namespace OpenCV +{ + partial class Form1 + { + /// + /// 필수 디자이너 변수입니다. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 사용 중인 모든 리소스를 정리합니다. + /// + /// 관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form 디자이너에서 생성한 코드 + + /// + /// 디자이너 지원에 필요한 메서드입니다. + /// 이 메서드의 내용을 코드 편집기로 수정하지 마세요. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.pictureBoxIpl1 = new OpenCvSharp.UserInterface.PictureBoxIpl(); + this.timer1 = new System.Windows.Forms.Timer(this.components); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxIpl1)).BeginInit(); + this.SuspendLayout(); + // + // pictureBoxIpl1 + // + this.pictureBoxIpl1.Location = new System.Drawing.Point(12, 12); + this.pictureBoxIpl1.Name = "pictureBoxIpl1"; + this.pictureBoxIpl1.Size = new System.Drawing.Size(640, 480); + this.pictureBoxIpl1.TabIndex = 0; + this.pictureBoxIpl1.TabStop = false; + // + // timer1 + // + this.timer1.Enabled = true; + this.timer1.Interval = 33; + this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + // + // 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.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(); + this.ResumeLayout(false); + + } + + #endregion + + private OpenCvSharp.UserInterface.PictureBoxIpl pictureBoxIpl1; + private System.Windows.Forms.Timer timer1; + } +} + diff --git a/OpenCV/Form1.cs b/OpenCV/Form1.cs new file mode 100644 index 0000000..a824d54 --- /dev/null +++ b/OpenCV/Form1.cs @@ -0,0 +1,46 @@ +using System; +using System.Windows.Forms; +using OpenCvSharp; + +namespace OpenCV +{ + public partial class Form1 : Form + { + CvCapture capture; + IplImage src; + + public Form1() + { + InitializeComponent(); + } + + private void Form1_Load(object sender, EventArgs e) + { + try + { + capture = CvCapture.FromCamera(CaptureDevice.DShow, 0); + capture.SetCaptureProperty(CaptureProperty.FrameWidth, 640); + capture.SetCaptureProperty(CaptureProperty.FrameHeight, 480); + + } + catch (Exception ex) + { + timer1.Enabled = false; + MessageBox.Show(ex.Message); + } + } + + private void timer1_Tick(object sender, EventArgs e) + { + src = capture.QueryFrame(); + pictureBoxIpl1.ImageIpl = src; + } + + private void Form1_FormClosing(object sender, FormClosingEventArgs e) + { + Cv.ReleaseImage(src); + if (src != null) + src.Dispose(); + } + } +} diff --git a/OpenCV/Form1.resx b/OpenCV/Form1.resx new file mode 100644 index 0000000..1f666f2 --- /dev/null +++ b/OpenCV/Form1.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/OpenCV/OpenCV.csproj b/OpenCV/OpenCV.csproj new file mode 100644 index 0000000..4981139 --- /dev/null +++ b/OpenCV/OpenCV.csproj @@ -0,0 +1,103 @@ + + + + + Debug + AnyCPU + {CE52DE2F-2E50-4FC9-96E2-F02D0E205EFC} + WinExe + OpenCV + OpenCV + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + bin\Debug\OpenCvSharp.dll + + + False + bin\Debug\OpenCvSharp.Blob.dll + + + False + bin\Debug\OpenCvSharp.CPlusPlus.dll + + + False + bin\Debug\OpenCvSharp.Extensions.dll + + + False + bin\Debug\OpenCvSharp.UserInterface.dll + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file diff --git a/OpenCV/Program.cs b/OpenCV/Program.cs new file mode 100644 index 0000000..2474f3e --- /dev/null +++ b/OpenCV/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace OpenCV +{ + static class Program + { + /// + /// 해당 애플리케이션의 주 진입점입니다. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/OpenCV/Properties/AssemblyInfo.cs b/OpenCV/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..c7f1893 --- /dev/null +++ b/OpenCV/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해 +// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면 +// 이러한 특성 값을 변경하세요. +[assembly: AssemblyTitle("OpenCV")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("OpenCV")] +[assembly: AssemblyCopyright("Copyright © 2022")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에 +// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면 +// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요. +[assembly: ComVisible(false)] + +// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다. +[assembly: Guid("ce52de2f-2e50-4fc9-96e2-f02d0e205efc")] + +// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다. +// +// 주 버전 +// 부 버전 +// 빌드 번호 +// 수정 버전 +// +// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를 +// 기본값으로 할 수 있습니다. +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OpenCV/Properties/Resources.Designer.cs b/OpenCV/Properties/Resources.Designer.cs new file mode 100644 index 0000000..90ce479 --- /dev/null +++ b/OpenCV/Properties/Resources.Designer.cs @@ -0,0 +1,70 @@ +//------------------------------------------------------------------------------ +// +// 이 코드는 도구를 사용하여 생성되었습니다. +// 런타임 버전:4.0.30319.42000 +// +// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면 +// 이러한 변경 내용이 손실됩니다. +// +//------------------------------------------------------------------------------ + + +namespace OpenCV.Properties +{ + /// + /// 지역화된 문자열 등을 찾기 위한 강력한 형식의 리소스 클래스입니다. + /// + // 이 클래스는 ResGen 또는 Visual Studio와 같은 도구를 통해 StronglyTypedResourceBuilder + // 클래스에서 자동으로 생성되었습니다. + // 멤버를 추가하거나 제거하려면 .ResX 파일을 편집한 다음 /str 옵션을 사용하여 + // ResGen을 다시 실행하거나 VS 프로젝트를 다시 빌드하십시오. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// 이 클래스에서 사용하는 캐시된 ResourceManager 인스턴스를 반환합니다. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OpenCV.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// 이 강력한 형식의 리소스 클래스를 사용하여 모든 리소스 조회에 대해 현재 스레드의 CurrentUICulture 속성을 + /// 재정의합니다. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/OpenCV/Properties/Resources.resx b/OpenCV/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/OpenCV/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/OpenCV/Properties/Settings.Designer.cs b/OpenCV/Properties/Settings.Designer.cs new file mode 100644 index 0000000..3f43e3c --- /dev/null +++ b/OpenCV/Properties/Settings.Designer.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +namespace OpenCV.Properties +{ + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/OpenCV/Properties/Settings.settings b/OpenCV/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/OpenCV/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + +