프로젝트

일반

사용자정보

개정판 16231f58

ID16231f58ac0aa96636789e45013d9a97576dc357
상위 5bec847f
하위 92e69742, 253c9730

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

issue #0000 imagecompare 수정
- rect을 opencv에서 그려 이미지로 출력

Change-Id: I241d6b62eb8dd88ae4a970c4e531d079bbaa3602

차이점 보기:

ImageComparer/ComparerTestWPF/MainWindow.xaml.cs
64 64
                var original = new System.Drawing.Bitmap(TxtOriginalImage.Text,true);
65 65
                var target = new System.Drawing.Bitmap(TxtTargetImage.Text, true);
66 66

  
67
                var result = imageCompare.CompareDrawRects(original, target, new System.Drawing.Size(20, 20));
67
                var result = imageCompare.CompareDrawRects(original, target, new System.Drawing.Size(1, 1));
68 68
                
69
                bitmapSource = imageCompare.CreateWriteableBitmapFromBitmap(result);
69
                bitmapSource = imageCompare.CreateWriteableBitmapFromBitmap(new[]{ result },result.Size);
70 70

  
71 71
                var original2= new System.Drawing.Bitmap(TxtOriginalImage.Text, true);
72 72
                var target2 = new System.Drawing.Bitmap(TxtTargetImage.Text, true);
73 73

  
74 74

  
75
                var result2 = imageCompare.CompareDrawRects(target2, original2, new System.Drawing.Size(20, 20));
75
                var result2 = imageCompare.CompareDrawRects(target2, original2, new System.Drawing.Size(1, 1));
76 76
                TargetSource = imageCompare.CreateBitmapSourceFromBitmap(result2);
77 77
            
78 78
                original.Dispose();
......
171 171

  
172 172
            imageView.Show();
173 173
        }
174

  
175
        private void btDrawContours_Click(object sender, RoutedEventArgs e)
176
        {
177
            BitmapSource bitmapSource = null;
178
            BitmapSource TargetSource = null;
179
            BitmapSource bitmapSourceContours = null;
180
            BitmapSource TargetSourceContours = null;
181
            var rectColor = System.Drawing.Color.FromArgb(150, 244, 15, 126);
182

  
183
            using (Markus.Image.ImageCompare imageCompare = new Markus.Image.ImageCompare())
184
            {
185
                var original = new System.Drawing.Bitmap(TxtOriginalImage.Text, true);
186
                var target = new System.Drawing.Bitmap(TxtTargetImage.Text, true);
187

  
188
                var sourceContours = imageCompare.CompareReturnDrawContours(original, target, rectColor);
189

  
190
                bitmapSource = imageCompare.CreateWriteableBitmapFromBitmap(
191
                    new List<System.Drawing.Bitmap> { new System.Drawing.Bitmap(TxtOriginalImage.Text, true),sourceContours }, original.Size);
192

  
193
                var original2 = new System.Drawing.Bitmap(TxtOriginalImage.Text, true);
194
                var target2 = new System.Drawing.Bitmap(TxtTargetImage.Text, true);
195

  
196
                var targetContours = imageCompare.CompareReturnDrawContours(target2, original2, rectColor);
197

  
198
                TargetSource = imageCompare.CreateWriteableBitmapFromBitmap(
199
                    new List<System.Drawing.Bitmap> { new System.Drawing.Bitmap(TxtTargetImage.Text, true), targetContours }, target2.Size);
200

  
201
                original.Dispose();
202
                target.Dispose();
203
            }
204

  
205
            if (bitmapSource != null && TargetSource != null)
206
            {
207
                ImageView imageView = new ImageView(bitmapSource);
208

  
209
                imageView.Show();
210

  
211

  
212
                ImageView imageView2 = new ImageView(TargetSource);
213

  
214
                imageView2.Show();
215
            }
216
            else
217
            {
218
                MessageBox.Show("bitmapSource is null");
219
            }
220
        }
174 221
    }
175 222
}

내보내기 Unified diff

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