프로젝트

일반

사용자정보

개정판 a860bafc

IDa860bafc057611814a09fb5898d619fb81e89017
상위 0c575433
하위 079a438a

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

issue #0000 compare 기능 수정

Change-Id: Idbac07b170a08bc67f50d315912f314da1ef8938

차이점 보기:

KCOM/Controls/ProgressControl.xaml
1
<Window x:Class="KCOM.Controls.ProgressControl"
2
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
5
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
6
             xmlns:local="clr-namespace:KCOM.Controls"
7
             Height="70" Width="300" Background="#FF007acc">
1
<Window
2
    x:Class="KCOM.Controls.ProgressControl"
3
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6
    xmlns:local="clr-namespace:KCOM.Controls"
7
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8
    Width="300"
9
    Height="70"
10
    Background="#FF007acc">
8 11
    <Grid>
9
        <ProgressBar HorizontalAlignment="Left" VerticalAlignment="Bottom" Height="18.1" x:Name="progressBar" Width="300" Background="Transparent" BorderThickness="0" 
10
                      Foreground="LightSlateGray"  Opacity="0.5"/>
11
        <TextBlock HorizontalAlignment="Left" VerticalAlignment="Bottom" TextAlignment="Center" x:Name="splashText" Foreground="AntiqueWhite"  FontWeight="ExtraBold" xml:space="preserve" Height="17.5">   Loading...</TextBlock>
12
        <ProgressBar
13
            x:Name="progressBar"
14
            Width="300"
15
            Height="18.1"
16
            HorizontalAlignment="Left"
17
            VerticalAlignment="Bottom"
18
            Background="Transparent"
19
            BorderThickness="0"
20
            Foreground="LightSlateGray"
21
            Opacity="0.5" />
22
        <TextBlock
23
            x:Name="splashText"
24
            Height="17.5"
25
            HorizontalAlignment="Left"
26
            VerticalAlignment="Bottom"
27
            xml:space="preserve"
28
            FontWeight="ExtraBold"
29
            Foreground="AntiqueWhite"
30
            TextAlignment="Center">   Loading...</TextBlock>
12 31
    </Grid>
13 32
</Window>
KCOM/KCOM.csproj
1465 1465
      <Project>{eb1de04a-d86e-4bf7-b095-f72207923c3b}</Project>
1466 1466
      <Name>Markus.Fonts</Name>
1467 1467
    </ProjectReference>
1468
    <ProjectReference Include="..\Markus.ImageComparer\Markus.ImageCompare.csproj">
1469
      <Project>{fd0e8645-8d75-4e5a-bbbb-9b62b07f8465}</Project>
1470
      <Name>Markus.ImageCompare</Name>
1471
    </ProjectReference>
1468 1472
    <ProjectReference Include="..\ZoomAndPan\ZoomAndPan.csproj">
1469 1473
      <Project>{6c950af4-04d2-4638-8b78-472e39f78b45}</Project>
1470 1474
      <Name>ZoomAndPan</Name>
KCOM/Properties/AssemblyInfo.cs
51 51
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호가 자동으로
52 52
// 지정되도록 할 수 있습니다.
53 53
// [assembly: AssemblyVersion("1.0.*")]
54
[assembly: AssemblyVersion("5.6.1.0")]
55
[assembly: AssemblyFileVersion("5.6.1.0")]
54
[assembly: AssemblyVersion("5.6.2.0")]
55
[assembly: AssemblyFileVersion("5.6.2.0")]
56 56
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "Log.config", Watch = true)]
KCOM/Services/BaseServices.cs
138 138
            }
139 139
            else
140 140
            {
141
                e.Result.ForEach(d =>
142
                {
143
                    d.Inflate(new Size(10, 10));
144

  
145
                    var point = MarkupToPDF.Controls.Common.MathSet.getRectMiddlePoint(d);
146
                    System.Windows.Shapes.Rectangle myEllipse = new System.Windows.Shapes.Rectangle();
147
                    myEllipse.Fill = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(150, 33, 215, 119));
148
                    myEllipse.Opacity = 1;
149
                    //myEllipse.Stroke = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Green);
150
                    //myEllipse.StrokeThickness = 2;
151
                    myEllipse.Width = d.Width;
152
                    myEllipse.Height = d.Height;
153
                    Canvas.SetLeft(myEllipse, d.X - ((point.X - d.X) / 2.0));
154
                    Canvas.SetTop(myEllipse, d.Y - ((point.Y - d.Y) / 2.0));
155
                    myEllipse.RenderTransformOrigin = point;
156
                    canvas_compareBorder.Children.Add(myEllipse);
157
                });
158
                canvas_compareBorder.Visibility = Visibility.Visible;
159
                da.From = 1;
160
                da.To = 0.5;
161
                da.Duration = new Duration(TimeSpan.FromSeconds(1));
162
                da.AutoReverse = true;
163
                canvas_compareBorder.BeginAnimation(OpacityProperty, da);
141
                CompareDisplay(e.Result);
164 142
            }
165 143
        }
166 144

  
145

  
167 146
        /// <summary>
168 147
        /// FinalPDF를 수행 후 관련 메시지를 표시한다.
169 148
        /// </summary>
KCOM/Views/MainMenu.xaml
1012 1012
                                    </telerik:RadGridView>
1013 1013
                                </Grid>
1014 1014
                                <!--</telerik:RadExpander>-->
1015

  
1016

  
1015
                                <!--<Border
1016
                                    x:Name="borderComprareWait"
1017
                                    Background="Gray"
1018
                                    Opacity="0.5"
1019
                                    Visibility="Collapsed">
1020
                                    <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
1021
                                        <ProgressBar
1022
                                            x:Name="progressCompare"
1023
                                            Width="250"
1024
                                            Height="15" />
1025
                                        <TextBlock
1026
                                            HorizontalAlignment="Center"
1027
                                            FontWeight="Bold"
1028
                                            Foreground="White"
1029
                                            Text="Waiting...." />
1030
                                    </StackPanel>
1031
                                </Border>-->
1017 1032
                            </Grid>
1018 1033
                        </telerik:RadPane>
1019 1034
                    </telerik:RadPaneGroup>
......
1348 1363
                            ShowGroupFooters="False"
1349 1364
                            ShowGroupPanel="True"
1350 1365
                            Sorted="GridViewMarkup_Sorted"
1351
                            Sorting="GridViewMarkup_Sorting"
1352
                            >
1353
                            
1354
                            <!-- Layer 추가 부분
1355
                            CanUserInsertRows="True"
1356
                            NewRowPosition="Top"
1357
                            AddingNewDataItem="gridViewMarkup_AddingNewDataItem"
1358
                            RowEditEnded="gridViewMarkup_RowEditEnded" 
1366
                            Sorting="GridViewMarkup_Sorting">
1367

  
1368
                            <!--
1369
                                Layer 추가 부분
1370
                                CanUserInsertRows="True"
1371
                                NewRowPosition="Top"
1372
                                AddingNewDataItem="gridViewMarkup_AddingNewDataItem"
1373
                                RowEditEnded="gridViewMarkup_RowEditEnded"
1359 1374
                            -->
1360
                            
1361
                            
1375

  
1376

  
1362 1377
                            <!--  SelectedCellsChanged="gridViewMarkup_SelectedCellsChanged"  -->
1363 1378
                            <!--<telerik:RadGridView.GroupDescriptors>
1364 1379
                                <telerik:GroupDescriptor Member="Depatment" SortDirection="Ascending" DisplayContent = "DEPT" x:Name="gDept">
KCOM/Views/MainMenu.xaml.cs
5371 5371
        /// <summary>
5372 5372
        /// 문서 Comprare
5373 5373
        /// </summary>
5374
        private void SetCompareRect()
5374
        private async void SetCompareRect()
5375 5375
        {
5376 5376
            canvas_compareBorder.Children.Clear();
5377 5377

  
5378 5378
            if (CompareMode.IsChecked)
5379 5379
            {
5380
                //borderComprareWait.Visibility = Visibility.Visible;
5381

  
5380 5382
                if (ViewerDataModel.Instance.PageBalanceMode && ViewerDataModel.Instance.PageBalanceNumber == 0)
5381 5383
                {
5382 5384
                    ViewerDataModel.Instance.PageBalanceNumber = 1;
......
5388 5390

  
5389 5391
                //Logger.sendReqLog("GetCompareRectsTargetSizeAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID + "," + CurrentRev.DOCUMENT_ID +"," + pageNavigator.CurrentPage.PageNumber.ToString() + "," + ViewerDataModel.Instance.PageNumber.ToString() + "," + userData.COMPANY != "EXT" ? "true" : "false", 1);
5390 5392

  
5391
                bool isTargetSize = false;
5393
                /// 비교대상원본, 비교할 대상
5394
                //BaseClient.GetCompareRectsTargetSizeAsync(_ViewInfo.ProjectNO, _ViewInfo.DocumentItemID,  CurrentRev.DOCUMENT_ID,  ViewerDataModel.Instance.SyncPageNumber.ToString(), pageNavigator.CurrentPage.PageNumber.ToString(), isTargetSize, userData.COMPANY != "EXT" ? "true" : "false");
5392 5395

  
5393
                if(OriginalSizeMode.IsChecked)
5396
                using (Markus.Image.ImageCompare imageCompare = new Markus.Image.ImageCompare())
5394 5397
                {
5395
                    isTargetSize = true;
5396
                }
5398
                    //imageCompare.Progress.PropertyChanged += (snd, evt) =>
5399
                    //{
5400
                    //    progressCompare.Dispatcher.InvokeAsync(() =>
5401
                    //    {
5402
                    //        progressCompare.Value = imageCompare.Progress.Percentage;
5403
                    //    });
5404
                    //};
5397 5405

  
5398
                /// 비교대상원본, 비교할 대상
5399
                BaseClient.GetCompareRectsTargetSizeAsync(_ViewInfo.ProjectNO, _ViewInfo.DocumentItemID,  CurrentRev.DOCUMENT_ID,  ViewerDataModel.Instance.SyncPageNumber.ToString(), pageNavigator.CurrentPage.PageNumber.ToString(), isTargetSize, userData.COMPANY != "EXT" ? "true" : "false");
5406
                    System.Drawing.Size imageSize = new System.Drawing.Size((int)ViewerDataModel.Instance.ImageViewWidth_C, (int)ViewerDataModel.Instance.ImageViewHeight_C);
5407

  
5408
                    var result = await imageCompare.CompareReturnRectsAsync(ViewerDataModel.Instance.ImageViewPath, ViewerDataModel.Instance.ImageViewPath_C, new System.Drawing.Size(10, 10), imageSize);
5409
                    
5410
                    //borderComprareWait.Visibility = Visibility.Collapsed;
5411

  
5412
                    CompareDisplay(result);
5413
                }
5400 5414
            }
5401 5415
            else
5402 5416
            {
......
5405 5419
            }
5406 5420
        }
5407 5421

  
5422
        private void CompareDisplay(List<Rect> rects)
5423
        {
5424
            rects.ForEach(d =>
5425
            {
5426
                d.Inflate(new Size(10, 10));
5427

  
5428
                var point = MarkupToPDF.Controls.Common.MathSet.getRectMiddlePoint(d);
5429
                System.Windows.Shapes.Rectangle myEllipse = new System.Windows.Shapes.Rectangle();
5430
                myEllipse.Fill = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(150, 33, 215, 119));
5431
                myEllipse.Opacity = 1;
5432
                //myEllipse.Stroke = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Green);
5433
                //myEllipse.StrokeThickness = 2;
5434
                myEllipse.Width = d.Width;
5435
                myEllipse.Height = d.Height;
5436
                Canvas.SetLeft(myEllipse, d.X - ((point.X - d.X) / 2.0));
5437
                Canvas.SetTop(myEllipse, d.Y - ((point.Y - d.Y) / 2.0));
5438
                myEllipse.RenderTransformOrigin = point;
5439
                canvas_compareBorder.Children.Add(myEllipse);
5440
            });
5441

  
5442
            canvas_compareBorder.Visibility = Visibility.Visible;
5443
            da.From = 1;
5444
            da.To = 0.5;
5445
            da.Duration = new Duration(TimeSpan.FromSeconds(1));
5446
            da.AutoReverse = true;
5447
            canvas_compareBorder.BeginAnimation(OpacityProperty, da);
5448
        }
5449

  
5408 5450
        private void btnSync_Click(object sender, RoutedEventArgs e)
5409 5451
        {
5410 5452
            gridViewHistory_Busy.IsBusy = true;
......
5488 5530
            string uri = this.GetImageURL(CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.SyncPageNumber);
5489 5531
            var isOriginalSize = !(ViewerDataModel.Instance.SyncPageNumber == pageNavigator.CurrentPage.PageNumber);
5490 5532

  
5533
            canvas_compareBorder.Visibility = Visibility.Hidden;
5534
            ClearCompareRect();
5535

  
5491 5536
            ComparePageLoad(uri, OriginalSizeMode.IsChecked);
5492 5537
        }
5493 5538

  
KCOM_API/KCOM_API.csproj
238 238
      <Project>{629dc8cd-d458-47ef-8f02-cd12c7001c3e}</Project>
239 239
      <Name>KCOMDataModel</Name>
240 240
    </ProjectReference>
241
    <ProjectReference Include="..\Markus.ImageComparer\Markus.ImageCompare.csproj">
242
      <Project>{fd0e8645-8d75-4e5a-bbbb-9b62b07f8465}</Project>
243
      <Name>Markus.ImageCompare</Name>
244
    </ProjectReference>
245 241
  </ItemGroup>
246 242
  <ItemGroup>
247 243
    <Folder Include="TileSource\000000_Tile\40000\4000005\" />
KCOM_API/Properties/PublishProfiles/FolderProfile.pubxml.user
7 7
  <PropertyGroup>
8 8
    <TimeStampOfAssociatedLegacyPublishXmlFile />
9 9
    <_PublishTargetUrl>D:\Source\Repos\MARKUS\publish\MarkusAPI</_PublishTargetUrl>
10
    <History>True|2024-09-01T12:42:00.1859844Z;True|2024-08-30T16:41:30.1624565+09:00;True|2024-04-08T14:30:26.6088230+09:00;True|2024-03-28T16:09:53.6272860+09:00;True|2024-03-20T17:07:27.3327545+09:00;True|2024-03-20T16:06:18.5686998+09:00;True|2024-03-20T16:05:52.6835054+09:00;True|2024-03-20T15:43:58.3135951+09:00;True|2024-03-20T15:03:19.8255162+09:00;True|2024-03-20T14:42:26.2958970+09:00;True|2024-01-19T17:15:52.8649804+09:00;True|2024-01-19T09:35:44.7523623+09:00;True|2024-01-18T17:04:43.6538702+09:00;True|2024-01-12T10:31:11.4820004+09:00;True|2023-11-15T12:54:34.6710396+09:00;True|2023-08-05T17:11:18.9473506+09:00;True|2023-08-05T17:10:51.1260416+09:00;True|2023-08-05T17:10:15.6768362+09:00;True|2023-08-05T17:05:00.6983156+09:00;True|2023-08-05T17:03:52.8404213+09:00;True|2023-08-05T17:02:21.8070007+09:00;True|2023-08-05T16:59:21.4828422+09:00;True|2023-04-26T09:20:18.0086339+09:00;True|2023-04-07T16:43:58.8972257+09:00;True|2023-04-07T14:06:40.4572438+09:00;True|2023-04-07T09:30:34.5436846+09:00;True|2023-04-06T14:45:18.6746547+09:00;True|2022-11-08T17:24:41.4219984+09:00;True|2022-11-05T17:01:00.1307411+09:00;True|2022-11-05T16:59:58.7400279+09:00;</History>
10
    <History>True|2024-09-02T13:30:25.2530981Z;True|2024-09-01T21:42:00.1859844+09:00;True|2024-08-30T16:41:30.1624565+09:00;True|2024-04-08T14:30:26.6088230+09:00;True|2024-03-28T16:09:53.6272860+09:00;True|2024-03-20T17:07:27.3327545+09:00;True|2024-03-20T16:06:18.5686998+09:00;True|2024-03-20T16:05:52.6835054+09:00;True|2024-03-20T15:43:58.3135951+09:00;True|2024-03-20T15:03:19.8255162+09:00;True|2024-03-20T14:42:26.2958970+09:00;True|2024-01-19T17:15:52.8649804+09:00;True|2024-01-19T09:35:44.7523623+09:00;True|2024-01-18T17:04:43.6538702+09:00;True|2024-01-12T10:31:11.4820004+09:00;True|2023-11-15T12:54:34.6710396+09:00;True|2023-08-05T17:11:18.9473506+09:00;True|2023-08-05T17:10:51.1260416+09:00;True|2023-08-05T17:10:15.6768362+09:00;True|2023-08-05T17:05:00.6983156+09:00;True|2023-08-05T17:03:52.8404213+09:00;True|2023-08-05T17:02:21.8070007+09:00;True|2023-08-05T16:59:21.4828422+09:00;True|2023-04-26T09:20:18.0086339+09:00;True|2023-04-07T16:43:58.8972257+09:00;True|2023-04-07T14:06:40.4572438+09:00;True|2023-04-07T09:30:34.5436846+09:00;True|2023-04-06T14:45:18.6746547+09:00;True|2022-11-08T17:24:41.4219984+09:00;True|2022-11-05T17:01:00.1307411+09:00;True|2022-11-05T16:59:58.7400279+09:00;</History>
11 11
  </PropertyGroup>
12 12
  <ItemGroup>
13 13
    <File Include="ActiveService.svc">
14 14
      <publishTime>06/22/2021 14:27:43</publishTime>
15 15
    </File>
16 16
    <File Include="bin/AddressModule.dll">
17
      <publishTime>08/30/2024 13:52:55</publishTime>
17
      <publishTime>09/02/2024 15:20:39</publishTime>
18 18
    </File>
19 19
    <File Include="bin/AddressModule.pdb">
20
      <publishTime>08/30/2024 13:52:55</publishTime>
20
      <publishTime>09/02/2024 15:20:39</publishTime>
21 21
    </File>
22 22
    <File Include="bin/CommonLib.dll">
23
      <publishTime>08/30/2024 13:52:55</publishTime>
23
      <publishTime>09/02/2024 15:44:32</publishTime>
24 24
    </File>
25 25
    <File Include="bin/CommonLib.pdb">
26
      <publishTime>08/30/2024 13:52:55</publishTime>
26
      <publishTime>09/02/2024 15:44:32</publishTime>
27 27
    </File>
28 28
    <File Include="bin/CompareLib.dll">
29 29
      <publishTime>03/27/2018 10:07:16</publishTime>
......
74 74
      <publishTime>09/19/2015 15:28:04</publishTime>
75 75
    </File>
76 76
    <File Include="bin/IFinalPDF.dll">
77
      <publishTime>08/30/2024 13:52:55</publishTime>
77
      <publishTime>09/02/2024 15:20:38</publishTime>
78 78
    </File>
79 79
    <File Include="bin/IFinalPDF.pdb">
80
      <publishTime>08/30/2024 13:52:55</publishTime>
80
      <publishTime>09/02/2024 15:20:38</publishTime>
81 81
    </File>
82 82
    <File Include="bin/IKCOM.dll">
83
      <publishTime>08/30/2024 13:53:02</publishTime>
83
      <publishTime>09/02/2024 16:46:19</publishTime>
84 84
    </File>
85 85
    <File Include="bin/IKCOM.pdb">
86
      <publishTime>08/30/2024 13:53:02</publishTime>
86
      <publishTime>09/02/2024 16:46:19</publishTime>
87 87
    </File>
88 88
    <File Include="bin/it/ZedGraph.resources.dll">
89 89
      <publishTime>09/19/2015 15:28:04</publishTime>
......
92 92
      <publishTime>09/19/2015 15:28:04</publishTime>
93 93
    </File>
94 94
    <File Include="bin/KCOMDataModel.dll">
95
      <publishTime>08/30/2024 13:52:56</publishTime>
95
      <publishTime>09/02/2024 15:44:32</publishTime>
96 96
    </File>
97 97
    <File Include="bin/KCOMDataModel.dll.config">
98 98
      <publishTime>06/08/2020 15:07:57</publishTime>
99 99
    </File>
100 100
    <File Include="bin/KCOMDataModel.pdb">
101
      <publishTime>08/30/2024 13:52:56</publishTime>
101
      <publishTime>09/02/2024 15:44:32</publishTime>
102 102
    </File>
103 103
    <File Include="bin/KCOM_API.dll">
104
      <publishTime>09/01/2024 21:52:41</publishTime>
104
      <publishTime>09/02/2024 17:15:52</publishTime>
105 105
    </File>
106 106
    <File Include="bin/KCOM_API.pdb">
107
      <publishTime>09/01/2024 21:52:41</publishTime>
107
      <publishTime>09/02/2024 17:15:52</publishTime>
108 108
    </File>
109 109
    <File Include="bin/Leadtools.Codecs.Cmp.dll">
110 110
      <publishTime>06/29/2017 11:38:22</publishTime>
......
140 140
      <publishTime>06/19/2020 06:34:52</publishTime>
141 141
    </File>
142 142
    <File Include="bin/Markus.ImageCompare.dll">
143
      <publishTime>08/30/2024 16:15:01</publishTime>
143
      <publishTime>09/02/2024 15:20:40</publishTime>
144 144
    </File>
145 145
    <File Include="bin/Markus.ImageCompare.pdb">
146
      <publishTime>08/30/2024 16:15:01</publishTime>
146
      <publishTime>09/02/2024 15:20:40</publishTime>
147 147
    </File>
148 148
    <File Include="bin/Markus.ImageHandler.dll">
149
      <publishTime>08/30/2024 13:52:55</publishTime>
149
      <publishTime>09/02/2024 15:20:40</publishTime>
150 150
    </File>
151 151
    <File Include="bin/Markus.ImageHandler.pdb">
152
      <publishTime>08/30/2024 13:52:55</publishTime>
152
      <publishTime>09/02/2024 15:20:40</publishTime>
153 153
    </File>
154 154
    <File Include="bin/Microsoft.IdentityModel.Abstractions.dll">
155 155
      <publishTime>07/28/2023 11:14:36</publishTime>
......
299 299
      <publishTime>02/27/2024 17:30:25</publishTime>
300 300
    </File>
301 301
    <File Include="Web.config">
302
      <publishTime>09/01/2024 21:52:55</publishTime>
302
      <publishTime>09/02/2024 22:30:18</publishTime>
303 303
    </File>
304 304
  </ItemGroup>
305 305
</Project>
KCOM_API/ServiceDeepView.svc.cs
311 311
                    }
312 312
                }
313 313

  
314
                using (Markus.Image.ImageCompare compareLib = new Markus.Image.ImageCompare())
315
                {
316
                    if (resultSize != null)
317
                    {
318
                        result = compareLib.CompareReturnRects(originFile, targetFile, new System.Drawing.Size(20, 20),resultSize);
319
                    }
320
                    else
321
                    {
322
                        result = compareLib.CompareReturnRects(originFile, targetFile, new System.Drawing.Size(20, 20), IsResultTargatSize);
323
                    }
324
                }
314
                //using (Markus.Image.ImageCompare compareLib = new Markus.Image.ImageCompare())
315
                //{
316
                //    //if (resultSize != null)
317
                //    //{
318
                //    //    result = compareLib.CompareReturnRects(originFile, targetFile, new System.Drawing.Size(10, 10),resultSize);
319
                //    //}
320
                //    //else
321
                //    //{
322
                //    //    result = compareLib.CompareReturnRects(originFile, targetFile, new System.Drawing.Size(10, 10), IsResultTargatSize);
323
                //    //}
324
                //}
325 325
            }
326 326
            catch (Exception ex)
327 327
            {
......
371 371
                //    targetFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath_SUB, projectNo, targetDocItem_ID, targetPageNo);
372 372
                //}
373 373

  
374
                using (Markus.Image.ImageCompare compareLib = new Markus.Image.ImageCompare())
375
                {
376
                    result = compareLib.CompareReturnRects(originFile, targetFile,new System.Drawing.Size(20, 20),false);
377
                }
374
                //using (Markus.Image.ImageCompare compareLib = new Markus.Image.ImageCompare())
375
                //{
376
                //    result = compareLib.CompareReturnRects(originFile, targetFile,new System.Drawing.Size(20, 20),false);
377
                //}
378 378
            }
379 379
            catch (Exception ex)
380 380
            {
......
433 433
                    targetFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath_SUB, projectNo, targetDocItem_ID, targetPageNo);
434 434
                }
435 435

  
436
                using (Markus.Image.ImageCompare compareLib = new Markus.Image.ImageCompare())
437
                {
436
                //using (Markus.Image.ImageCompare compareLib = new Markus.Image.ImageCompare())
437
                //{
438 438

  
439
                    result = compareLib.CompareReturnRects(originFile, targetFile, new System.Drawing.Size(20, 20),false);
440
                }
439
                //    result = compareLib.CompareReturnRects(originFile, targetFile, new System.Drawing.Size(20, 20),false);
440
                //}
441 441
            }
442 442
            catch (Exception ex)
443 443
            {
Markus.ImageComparer/Converter.cs
1
using System;
2
using System.Collections.Generic;
3
using System.Drawing;
4
using System.IO;
5
using System.Linq;
6
using System.Text;
7
using System.Threading.Tasks;
8
using System.Windows.Media.Imaging;
9

  
10
namespace Markus.Image
11
{
12
    public static class Converter
13
    {
14
        public static Bitmap ConvertBitmapFrameToBitmap(BitmapSource bitmapSource)
15
        {
16
            using (MemoryStream outStream = new MemoryStream())
17
            {
18
                BitmapEncoder enc = new BmpBitmapEncoder();
19
                enc.Frames.Add(BitmapFrame.Create(bitmapSource,null,null,null));
20
                enc.Save(outStream);
21
                outStream.Seek(0, SeekOrigin.Begin);
22
                using (Bitmap bitmap = new Bitmap(outStream))
23
                {
24
                    return new Bitmap(bitmap); // 새로운 Bitmap 객체를 반환하여 원본을 해제
25
                }
26
            }
27
        }
28
    }
29
}
Markus.ImageComparer/ImageCompare.cs
138 138

  
139 139
            return result;
140 140
        }
141
        public List<System.Windows.Rect> CompareReturnRects(System.Windows.Media.Imaging.BitmapFrame OriginalbitmapFrame, System.Windows.Media.Imaging.BitmapFrame TargatBitmapFrame, Size ResultRectSize, Size? ResultImageSize = null)
142
        {
143
            return CompareReturnRects(Converter.ConvertBitmapFrameToBitmap(OriginalbitmapFrame), Converter.ConvertBitmapFrameToBitmap(TargatBitmapFrame), ResultRectSize, ResultImageSize);
144
        }
141 145

  
142 146
        /// <summary>
143 147
        /// 이미지를 비교 후 해당 영역을 Rect로 반환한다.
......
184 188
            }
185 189
            finally
186 190
            {
187

  
191
                Originalbitmap.Dispose();
192
                TargatBitmap.Dispose();
188 193
            }
189 194

  
190 195
            return result;
......
418 423
            return result;
419 424
        }
420 425

  
421
        /// <summary>
422
        /// 이미지를 비교 후 해당 영역을 Rect로 반환한다.
423
        /// </summary>
424
        /// <param name="Originalbitmap">원본 이미지</param>
425
        /// <param name="TargatBitmap">비교대상 이미지</param>
426
        /// <param name="ResultRectSize">반환되는 Rect의 사이즈</param>
427
        /// <returns></returns>
426
        public async Task<List<System.Windows.Rect>> CompareReturnRectsAsync(System.Windows.Media.Imaging.BitmapSource OriginalbitmapFrame, System.Windows.Media.Imaging.BitmapSource TargatBitmapFrame, Size ResultRectSize, Size? ResultImageSize = null)
427
        {
428
            return await CompareReturnRectsAsync(Converter.ConvertBitmapFrameToBitmap(OriginalbitmapFrame), Converter.ConvertBitmapFrameToBitmap(TargatBitmapFrame), ResultRectSize, ResultImageSize);
429
        }
430

  
431

  
432
            /// <summary>
433
            /// 이미지를 비교 후 해당 영역을 Rect로 반환한다.
434
            /// </summary>
435
            /// <param name="Originalbitmap">원본 이미지</param>
436
            /// <param name="TargatBitmap">비교대상 이미지</param>
437
            /// <param name="ResultRectSize">반환되는 Rect의 사이즈</param>
438
            /// <returns></returns>
428 439
        public async Task<List<System.Windows.Rect>> CompareReturnRectsAsync(System.Drawing.Bitmap Originalbitmap, System.Drawing.Bitmap TargatBitmap, Size ResultRectSize,Size? ResultImageSize = null)
429 440
        {
430 441
            List<System.Windows.Rect> result = new List<System.Windows.Rect>();
......
442 453

  
443 454
                result = await GetMatchPixelsAsnc(data, ResultRectSize);
444 455

  
445
                //var data2 = MathchesImageData(TargatBitmap, Originalbitmap, Originalbitmap.Size);
446

  
447
                //var result2 = await GetMatchPixelsAsnc(data2, ResultRectSize);
448
                
449
                //result.AddRange(result2);
450

  
451
                //result = result.Distinct().ToList();
452
                //result = JoinRectList(result);
453
                //if (result.Count() > 0)
454
                //{
455
                //    result = Merge(result, ResultRectSize.Height);
456
                //}
457

  
458 456
                data = null;
459 457
            }
460 458
            catch (Exception ex)
Markus.ImageComparer/ImageCompareBase.cs
1 1
using OpenCvSharp;
2 2
using System;
3
using System.Collections.Concurrent;
3 4
using System.Collections.Generic;
4 5
using System.Drawing;
5 6
using System.Drawing.Imaging;
......
10 11
using System.Text;
11 12
using System.Threading;
12 13
using System.Threading.Tasks;
14
using System.Windows.Media.Imaging;
13 15
using Point = System.Drawing.Point;
14 16
using Size = System.Drawing.Size;
15 17

  
......
21 23
        Mat TargatImageData = null;
22 24

  
23 25
        double contoursLongCount = 0;
24
        double ComparisonCount = 0;
26
        int ComparisonCount = 0;
25 27
        public CompareProgress Progress = new CompareProgress();
26 28

  
27 29
        private void SetStatus(string message,double percentage,CompareStatus status)
28 30
        {
29
            System.Diagnostics.Debug.WriteLine(percentage);
31
            //System.Diagnostics.Debug.WriteLine(percentage);
30 32

  
31 33
            Progress.Message = message;
32 34
            Progress.Percentage = percentage;
......
63 65
                Cv2.CvtColor(OriginalImageData, OriginalImageData, ColorConversionCodes.BGR2GRAY);
64 66
                Cv2.CvtColor(TargatImageData, TargatImageData, ColorConversionCodes.BGR2GRAY);
65 67

  
66
                Mat outputData = new Mat(TargatImageData.Size(), MatType.CV_8UC1);
68
                Mat outputData = new Mat(new OpenCvSharp.Size(resultSize.Width, resultSize.Height), MatType.CV_8UC1);
67 69

  
68 70
                Cv2.Absdiff(OriginalImageData, TargatImageData, outputData);
69 71

  
......
81 83
            return result;
82 84
        }
83 85

  
84
        protected System.Drawing.Bitmap ChangeBitmapFormatAndSize(System.Drawing.Bitmap bitmap, Size newSize, PixelFormat pixelFormat)
85
        {
86
            Bitmap result = bitmap;
87

  
88
            if (pixelFormat != bitmap.PixelFormat)
89
            {
90
                Point originPoint = new Point(0, 0);
91
                Rectangle rect = new Rectangle(originPoint, bitmap.Size);
92
                result = bitmap.Clone(rect, pixelFormat);
93
            }
94

  
95
            if (bitmap.Size != newSize)
96
            {
97
                result = new Bitmap(newSize.Width, newSize.Height);
98

  
99
                using (Graphics g = Graphics.FromImage(result))
100
                {
101
                    g.DrawImage(bitmap, 0, 0, newSize.Width, newSize.Height);
102
                    g.Dispose();
103
                }
104
            }
105

  
106
            return result;
107
        }
108 86

  
109 87
        /// <summary>
110 88
        /// Image<TColor, TDepth>의 틀린 부분을 Rect로 반환
......
131 109

  
132 110
            OpenCvSharp.Point testpoint = new OpenCvSharp.Point();
133 111
           
134
            Cv2.Threshold(data, data, 0, 30,ThresholdTypes.BinaryInv);
112
            Cv2.Threshold(data, data, 50, 255,ThresholdTypes.BinaryInv);
135 113

  
136
            Cv2.FindContours(data, out contours, out hierarchy,RetrievalModes.List,ContourApproximationModes.ApproxNone, testpoint);
114
            Cv2.FindContours(data, out contours, out hierarchy,RetrievalModes.List,ContourApproximationModes.ApproxSimple, testpoint);
137 115

  
138 116
            SetStatus("Comparison", 0, CompareStatus.Comparison);
139 117
            contoursLongCount = contours.Sum(x => x.Count());
......
149 127
             
150 128
            return results;
151 129
        }
130

  
152 131
        private List<System.Windows.Rect> GetRectList(OpenCvSharp.Point[] points, Size block)
153 132
        {
154 133
            List<System.Windows.Rect> result = new List<System.Windows.Rect>();
155
            HashSet<System.Windows.Rect> rectSet = new HashSet<System.Windows.Rect>();
134
            ConcurrentBag<System.Windows.Rect> rectBag = new ConcurrentBag<System.Windows.Rect>();
156 135

  
157 136
            Parallel.For(0, points.Length, i =>
158 137
            {
......
164 143
                    Height = block.Height
165 144
                };
166 145

  
167
                lock (rectSet)
146
                if (!rectBag.Any(r => r.IntersectsWith(rect)))
168 147
                {
169
                    if (!rectSet.Any(r => r.IntersectsWith(rect)))
170
                    {
171
                        rectSet.Add(rect);
172
                        result.Add(rect);
173
                    }
148
                    rectBag.Add(rect);
149
                    result.Add(rect);
174 150
                }
175 151

  
176
                int comparisonCount = 0;
177
                Interlocked.Increment(ref comparisonCount);
178
                
179
                ComparisonCount = comparisonCount;
152
                Interlocked.Increment(ref ComparisonCount);
180 153

  
181
                SetStatus("Comparison", ComparisonCount / (double)contoursLongCount * 100, CompareStatus.Comparison);
154
                SetStatus("Comparison", (double)ComparisonCount / (double)contoursLongCount * 100, CompareStatus.Comparison);
182 155
            });
183 156

  
184 157
            return result;
185 158
        }
186 159

  
160
        protected System.Drawing.Bitmap ChangeBitmapFormatAndSize(System.Drawing.Bitmap bitmap, Size newSize, PixelFormat pixelFormat)
161
        {
162
            Bitmap result = bitmap;
163

  
164
            if (pixelFormat != bitmap.PixelFormat)
165
            {
166
                Point originPoint = new Point(0, 0);
167
                Rectangle rect = new Rectangle(originPoint, bitmap.Size);
168
                result = bitmap.Clone(rect, pixelFormat);
169
            }
170

  
171
            if (bitmap.Size != newSize)
172
            {
173
                result = new Bitmap(newSize.Width, newSize.Height);
174

  
175
                using (Graphics g = Graphics.FromImage(result))
176
                {
177
                    g.DrawImage(bitmap, 0, 0, newSize.Width, newSize.Height);
178
                    g.Dispose();
179
                }
180
            }
181

  
182
            return result;
183
        }
184

  
185

  
187 186
        private List<System.Windows.Rect> GetRectList2(OpenCvSharp.Point[] points,Size block)
188 187
        {
189 188
            List<System.Windows.Rect> result = new List<System.Windows.Rect>();

내보내기 Unified diff

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