프로젝트

일반

사용자정보

개정판 51477835

ID51477835da26b21b0be7f416791047c57c959a11
상위 9f61d7b6
하위 b181bf47

김태성이(가) 4년 이상 전에 추가함

opencv 버전 변경

Change-Id: I473f317b919be42864e1098509773728a764688e

차이점 보기:

ImageComparer/ComparerTestWPF/App.config
1
<?xml version="1.0" encoding="utf-8" ?>
1
<?xml version="1.0" encoding="utf-8"?>
2 2
<configuration>
3 3
  <startup> 
4
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
4
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
5 5
    </startup>
6
</configuration>
6
</configuration>
ImageComparer/ComparerTestWPF/ComparerTestWPF.csproj
8 8
    <OutputType>WinExe</OutputType>
9 9
    <RootNamespace>ComparerTestWPF</RootNamespace>
10 10
    <AssemblyName>ComparerTestWPF</AssemblyName>
11
    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
11
    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
12 12
    <FileAlignment>512</FileAlignment>
13 13
    <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
14 14
    <WarningLevel>4</WarningLevel>
......
28 28
    <IsWebBootstrapper>false</IsWebBootstrapper>
29 29
    <UseApplicationTrust>false</UseApplicationTrust>
30 30
    <BootstrapperEnabled>true</BootstrapperEnabled>
31
    <TargetFrameworkProfile />
31 32
  </PropertyGroup>
32 33
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
33
    <PlatformTarget>x64</PlatformTarget>
34
    <PlatformTarget>AnyCPU</PlatformTarget>
34 35
    <DebugSymbols>true</DebugSymbols>
35 36
    <DebugType>full</DebugType>
36 37
    <Optimize>false</Optimize>
......
48 49
    <DefineConstants>TRACE</DefineConstants>
49 50
    <ErrorReport>prompt</ErrorReport>
50 51
    <WarningLevel>4</WarningLevel>
52
    <Prefer32Bit>false</Prefer32Bit>
51 53
  </PropertyGroup>
52 54
  <ItemGroup>
53 55
    <Reference Include="System" />
......
121 123
    <None Include="App.config" />
122 124
  </ItemGroup>
123 125
  <ItemGroup>
124
    <ProjectReference Include="..\Markus.ImageComparer\Markus.Image.csproj">
125
      <Project>{b3b05ced-f4eb-4f9d-b458-12fcbe48d546}</Project>
126
      <Name>Markus.Image</Name>
127
    </ProjectReference>
128
  </ItemGroup>
129
  <ItemGroup>
130 126
    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
131 127
      <Visible>False</Visible>
132 128
      <ProductName>.NET Framework 3.5 SP1</ProductName>
133 129
      <Install>false</Install>
134 130
    </BootstrapperPackage>
135 131
  </ItemGroup>
132
  <ItemGroup>
133
    <ProjectReference Include="..\Markus.ImageComparer\Markus.Image.csproj">
134
      <Project>{b3b05ced-f4eb-4f9d-b458-12fcbe48d546}</Project>
135
      <Name>Markus.Image</Name>
136
    </ProjectReference>
137
  </ItemGroup>
136 138
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
137 139
</Project>
ImageComparer/ComparerTestWPF/Properties/Resources.Designer.cs
8 8
// </auto-generated>
9 9
//------------------------------------------------------------------------------
10 10

  
11
namespace ComparerTestWPF.Properties
12
{
13

  
14

  
11
namespace ComparerTestWPF.Properties {
12
    using System;
13
    
14
    
15 15
    /// <summary>
16 16
    ///   지역화된 문자열 등을 찾기 위한 강력한 형식의 리소스 클래스입니다.
17 17
    /// </summary>
18 18
    // 이 클래스는 ResGen 또는 Visual Studio와 같은 도구를 통해 StronglyTypedResourceBuilder
19 19
    // 클래스에서 자동으로 생성되었습니다.
20
    // 멤버를 추가하거나 제거하려면 .ResX 파일을 편집한 다음 /str 옵션을 사용하여
21
    // ResGen을 다시 실행하거나 VS 프로젝트를 다시 빌드하십시오.
22
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
20
    // 멤버를 추가하거나 제거하려면 .ResX 파일을 편집한 다음 /str 옵션을 사용하여 ResGen을
21
    // 다시 실행하거나 VS 프로젝트를 다시 빌드하십시오.
22
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
23 23
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 24
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25
    internal class Resources
26
    {
27

  
25
    internal class Resources {
26
        
28 27
        private static global::System.Resources.ResourceManager resourceMan;
29

  
28
        
30 29
        private static global::System.Globalization.CultureInfo resourceCulture;
31

  
30
        
32 31
        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33
        internal Resources()
34
        {
32
        internal Resources() {
35 33
        }
36

  
34
        
37 35
        /// <summary>
38 36
        ///   이 클래스에서 사용하는 캐시된 ResourceManager 인스턴스를 반환합니다.
39 37
        /// </summary>
40 38
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41
        internal static global::System.Resources.ResourceManager ResourceManager
42
        {
43
            get
44
            {
45
                if ((resourceMan == null))
46
                {
39
        internal static global::System.Resources.ResourceManager ResourceManager {
40
            get {
41
                if (object.ReferenceEquals(resourceMan, null)) {
47 42
                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ComparerTestWPF.Properties.Resources", typeof(Resources).Assembly);
48 43
                    resourceMan = temp;
49 44
                }
50 45
                return resourceMan;
51 46
            }
52 47
        }
53

  
48
        
54 49
        /// <summary>
55 50
        ///   이 강력한 형식의 리소스 클래스를 사용하여 모든 리소스 조회에 대해 현재 스레드의 CurrentUICulture 속성을
56 51
        ///   재정의합니다.
57 52
        /// </summary>
58 53
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59
        internal static global::System.Globalization.CultureInfo Culture
60
        {
61
            get
62
            {
54
        internal static global::System.Globalization.CultureInfo Culture {
55
            get {
63 56
                return resourceCulture;
64 57
            }
65
            set
66
            {
58
            set {
67 59
                resourceCulture = value;
68 60
            }
69 61
        }
ImageComparer/ComparerTestWPF/Properties/Settings.Designer.cs
1 1
//------------------------------------------------------------------------------
2 2
// <auto-generated>
3
//     This code was generated by a tool.
4
//     Runtime Version:4.0.30319.42000
3
//     이 코드는 도구를 사용하여 생성되었습니다.
4
//     런타임 버전:4.0.30319.42000
5 5
//
6
//     Changes to this file may cause incorrect behavior and will be lost if
7
//     the code is regenerated.
6
//     파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
7
//     이러한 변경 내용이 손실됩니다.
8 8
// </auto-generated>
9 9
//------------------------------------------------------------------------------
10 10

  
11
namespace ComparerTestWPF.Properties
12
{
13

  
14

  
11
namespace ComparerTestWPF.Properties {
12
    
13
    
15 14
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17
    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18
    {
19

  
15
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
16
    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17
        
20 18
        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21

  
22
        public static Settings Default
23
        {
24
            get
25
            {
19
        
20
        public static Settings Default {
21
            get {
26 22
                return defaultInstance;
27 23
            }
28 24
        }
ImageComparer/Markus.ImageComparer/ImageComparerBase.cs
1 1
using OpenCvSharp;
2
using OpenCvSharp.CPlusPlus;
3 2
using System;
4 3
using System.Collections.Generic;
5 4
using System.Drawing;
......
57 56
                    Cv2.Resize(TargatImageData, TargatImageData, OriginalImageData.Size());
58 57
                }
59 58
                
60
                Cv2.CvtColor(OriginalImageData, OriginalImageData, ColorConversion.BgrToGray);
61
                Cv2.CvtColor(TargatImageData, TargatImageData, ColorConversion.BgrToGray);
59
                Cv2.CvtColor(OriginalImageData, OriginalImageData, ColorConversionCodes.BGR2GRAY);
60
                Cv2.CvtColor(TargatImageData, TargatImageData, ColorConversionCodes.BGR2GRAY);
62 61

  
63 62
                Mat outputData = new Mat(TargatImageData.Size(), MatType.CV_8UC1);
64 63

  
65 64
                Cv2.Absdiff(OriginalImageData, TargatImageData, outputData);
66 65

  
67
                Mat outputtest = new Mat(TargatImageData.Size(), MatType.CV_8UC1);
68
                Cv2.MatchTemplate(OriginalImageData, TargatImageData, outputtest, MatchTemplateMethod.CCoeffNormed);
69
                Cv2.ImWrite(@"D:\testsave\test1.png", outputtest);
70

  
71 66
                // 틀린부분을 반환
72 67
                Cv2.BitwiseNot(outputData, result);
73 68
            }
......
88 83
        /// <param name="data"></param>
89 84
        /// <param name="block"></param>
90 85
        /// <returns></returns>
91
        protected List<System.Windows.Rect> GetMatchPixels(OpenCvSharp.CPlusPlus.Mat data, Size block)
86
        protected List<System.Windows.Rect> GetMatchPixels(Mat data, Size block)
92 87
        {
93 88
            SetStatus("Detection", 0, CompareStatus.Detection);
94 89

  
......
103 98
            Mat outputMat = new Mat(data.Size(), MatType.CV_8UC1);
104 99

  
105 100
            HierarchyIndex[] hierarchy;
106
            OpenCvSharp.CPlusPlus.Point[][] contours;
101
            OpenCvSharp.Point[][] contours;
107 102

  
108
            OpenCvSharp.CPlusPlus.Point testpoint = new OpenCvSharp.CPlusPlus.Point();
103
            OpenCvSharp.Point testpoint = new OpenCvSharp.Point();
109 104
           
110
            Cv2.Threshold(data, data, 90, 255,ThresholdType.BinaryInv);
105
            Cv2.Threshold(data, data, 90, 255,ThresholdTypes.BinaryInv);
111 106

  
112
            Cv2.FindContours(data, out contours, out hierarchy, ContourRetrieval.List, ContourChain.ApproxNone, testpoint);
107
            Cv2.FindContours(data, out contours, out hierarchy,RetrievalModes.List,ContourApproximationModes.ApproxNone, testpoint);
113 108

  
114 109
            SetStatus("Comparison", 0, CompareStatus.Comparison);
115 110
            contoursLongCount = contours.Sum(x => x.Count());
......
123 118
            return results;
124 119
        }
125 120

  
126
        private List<System.Windows.Rect> GetRectList(OpenCvSharp.CPlusPlus.Point[] points,Size block)
121
        private List<System.Windows.Rect> GetRectList(OpenCvSharp.Point[] points,Size block)
127 122
        {
128 123
            List<System.Windows.Rect> result = new List<System.Windows.Rect>();
129 124

  
......
156 151
        /// <param name="data"></param>
157 152
        /// <param name="block"></param>
158 153
        /// <returns></returns>
159
        protected async Task<List<System.Windows.Rect>> GetMatchPixelsAsnc(OpenCvSharp.CPlusPlus.Mat data, Size block)
154
        protected async Task<List<System.Windows.Rect>> GetMatchPixelsAsnc(Mat data, Size block)
160 155
        {
161 156
            return await Task.Factory.StartNew<List<System.Windows.Rect>>(() =>
162 157
            {
ImageComparer/Markus.ImageComparer/Markus.Image.csproj
1 1
<?xml version="1.0" encoding="utf-8"?>
2 2
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
  <Import Project="..\packages\OpenCvSharp-AnyCPU.2.4.10.20170306\build\OpenCvSharp-AnyCPU.props" Condition="Exists('..\packages\OpenCvSharp-AnyCPU.2.4.10.20170306\build\OpenCvSharp-AnyCPU.props')" />
3
  <Import Project="..\packages\OpenCvSharp4.runtime.win.4.3.0.20200524\build\net\OpenCvSharp4.runtime.win.props" Condition="Exists('..\packages\OpenCvSharp4.runtime.win.4.3.0.20200524\build\net\OpenCvSharp4.runtime.win.props')" />
4 4
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
5 5
  <PropertyGroup>
6 6
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
......
10 10
    <AppDesignerFolder>Properties</AppDesignerFolder>
11 11
    <RootNamespace>Markus.Image</RootNamespace>
12 12
    <AssemblyName>Markus.Image.OpenCV</AssemblyName>
13
    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13
    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
14 14
    <FileAlignment>512</FileAlignment>
15 15
    <Deterministic>true</Deterministic>
16 16
    <NuGetPackageImportStamp>
17 17
    </NuGetPackageImportStamp>
18
    <TargetFrameworkProfile />
18 19
  </PropertyGroup>
19 20
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
20 21
    <DebugSymbols>true</DebugSymbols>
......
24 25
    <DefineConstants>DEBUG;TRACE</DefineConstants>
25 26
    <ErrorReport>prompt</ErrorReport>
26 27
    <WarningLevel>4</WarningLevel>
27
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
28
    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
28 29
  </PropertyGroup>
29 30
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
30 31
    <DebugType>pdbonly</DebugType>
......
36 37
  </PropertyGroup>
37 38
  <ItemGroup>
38 39
    <Reference Include="OpenCvSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
39
      <HintPath>..\packages\OpenCvSharp-AnyCPU.2.4.10.20170306\lib\net45\OpenCvSharp.dll</HintPath>
40
      <HintPath>..\packages\OpenCvSharp4.4.3.0.20200524\lib\net461\OpenCvSharp.dll</HintPath>
40 41
    </Reference>
41 42
    <Reference Include="OpenCvSharp.Blob, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
42
      <HintPath>..\packages\OpenCvSharp-AnyCPU.2.4.10.20170306\lib\net45\OpenCvSharp.Blob.dll</HintPath>
43
    </Reference>
44
    <Reference Include="OpenCvSharp.CPlusPlus, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
45
      <HintPath>..\packages\OpenCvSharp-AnyCPU.2.4.10.20170306\lib\net45\OpenCvSharp.CPlusPlus.dll</HintPath>
43
      <HintPath>..\packages\OpenCvSharp4.4.3.0.20200524\lib\net461\OpenCvSharp.Blob.dll</HintPath>
46 44
    </Reference>
47 45
    <Reference Include="OpenCvSharp.Extensions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
48
      <HintPath>..\packages\OpenCvSharp-AnyCPU.2.4.10.20170306\lib\net45\OpenCvSharp.Extensions.dll</HintPath>
49
    </Reference>
50
    <Reference Include="OpenCvSharp.UserInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
51
      <HintPath>..\packages\OpenCvSharp-AnyCPU.2.4.10.20170306\lib\net45\OpenCvSharp.UserInterface.dll</HintPath>
46
      <HintPath>..\packages\OpenCvSharp4.4.3.0.20200524\lib\net461\OpenCvSharp.Extensions.dll</HintPath>
52 47
    </Reference>
53 48
    <Reference Include="PresentationCore" />
54 49
    <Reference Include="PresentationFramework" />
55 50
    <Reference Include="System" />
56 51
    <Reference Include="System.Core" />
57 52
    <Reference Include="System.Drawing" />
53
    <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
54
      <HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.7.1\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
55
    </Reference>
58 56
    <Reference Include="System.Windows.Forms" />
59 57
    <Reference Include="System.Xml.Linq" />
60 58
    <Reference Include="System.Data.DataSetExtensions" />
......
81 79
    <PropertyGroup>
82 80
      <ErrorText>이 프로젝트는 이 컴퓨터에 없는 NuGet 패키지를 참조합니다. 해당 패키지를 다운로드하려면 NuGet 패키지 복원을 사용하십시오. 자세한 내용은 http://go.microsoft.com/fwlink/?LinkID=322105를 참조하십시오. 누락된 파일은 {0}입니다.</ErrorText>
83 81
    </PropertyGroup>
84
    <Error Condition="!Exists('..\packages\OpenCvSharp-AnyCPU.2.4.10.20170306\build\OpenCvSharp-AnyCPU.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\OpenCvSharp-AnyCPU.2.4.10.20170306\build\OpenCvSharp-AnyCPU.props'))" />
82
    <Error Condition="!Exists('..\packages\OpenCvSharp4.runtime.win.4.3.0.20200524\build\net\OpenCvSharp4.runtime.win.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\OpenCvSharp4.runtime.win.4.3.0.20200524\build\net\OpenCvSharp4.runtime.win.props'))" />
85 83
  </Target>
86 84
</Project>
ImageComparer/Markus.ImageComparer/OpenCVExtensions.cs
4 4
using System.Linq;
5 5
using System.Text;
6 6
using System.Threading.Tasks;
7
using OpenCvSharp.CPlusPlus;
8 7

  
9 8
namespace Markus.Image
10 9
{
......
13 12
    /// </summary>
14 13
    public static class OpenCVExtensions
15 14
    {
16
        public static T GetValue<T>(this OpenCvSharp.CPlusPlus.Mat mat,int Row,int Col) where T : struct
15
        public static T GetValue<T>(this OpenCvSharp.Mat mat,int Row,int Col) where T : struct
17 16
        {
18 17
            return mat.Get<T>(Row, Col);
19 18
        }
20 19

  
21
        public static IEnumerable<ImageData<float>> ToDataFloat(this OpenCvSharp.CPlusPlus.Mat mat)
20
        public static IEnumerable<ImageData<float>> ToDataFloat(this OpenCvSharp.Mat mat)
22 21
        {
23 22
            for (int i = 0; i < mat.Rows; i++)
24 23
            {
......
40 39
        //    }
41 40
        //}
42 41

  
43
        public static IEnumerable<ImageData<T>> ToData<T>(this OpenCvSharp.CPlusPlus.Mat mat) where T : struct
44
        {
45
            for (int i = 0; i < mat.Rows; i++)
46
            {
47
                for (int j = 0; j < mat.Cols; j++)
48
                {
49
                    yield return new ImageData<T> { Row = i, Col = j, Value = mat.At<T>(i, j) };
50
                }
51
            }
52
        }
42
        //public static IEnumerable<ImageData<T>> ToData<T>(this OpenCvSharp.Mat mat) where T : struct
43
        //{
44
        //    for (int i = 0; i < mat.Rows; i++)
45
        //    {
46
        //        for (int j = 0; j < mat.Cols; j++)
47
        //        {
48
        //            yield return new ImageData<T> { Row = i, Col = j, Value = mat.At<T>(i, j) };
49
        //        }
50
        //    }
51
        //}
53 52
    }
54 53

  
55 54

  
ImageComparer/Markus.ImageComparer/packages.config
1 1
<?xml version="1.0" encoding="utf-8"?>
2 2
<packages>
3
  <package id="OpenCvSharp-AnyCPU" version="2.4.10.20170306" targetFramework="net45" />
3
  <package id="OpenCvSharp4" version="4.3.0.20200524" targetFramework="net461" />
4
  <package id="OpenCvSharp4.runtime.win" version="4.3.0.20200524" targetFramework="net461" />
5
  <package id="OpenCvSharp4.Windows" version="4.3.0.20200524" targetFramework="net461" />
6
  <package id="System.Runtime.CompilerServices.Unsafe" version="4.7.1" targetFramework="net461" />
4 7
</packages>

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)