Beispiel #1
0
        private void ExecuteCheck()
        {
            if (ImageList.Count > 1)
            {
                double totalCompareCount = (ImageList.Count * (ImageList.Count - 1)) / 2;
                double completeCount     = 0.0;

                Enabled = false;

                foreach (var source in ImageList)
                {
                    foreach (var target in ImageList.Where(x => x.No != source.No && x.Checked == false))
                    {
                        var comparer = new ImageComparer();

                        comparer.Source = source;
                        source.Checked  = true;

                        comparer.Target = target;
                        var similarity = comparer.CalculateSimilarity();

                        if (similarity > 0.9)
                        {
                            var window = new SelectWindow();
                            var vm     = window.DataContext as SelectWindowViewModel;

                            if (vm.IsNotNull())
                            {
                                vm.Pic1       = source;
                                vm.Pic2       = target;
                                vm.Similarity = (int)((System.Math.Round(similarity, 2)) * 100);
                                window.ShowDialog();
                                window.DataContext = null;
                            }
                        }

                        comparer.Dispose();

                        _uiTaskHelper.ChangeByDispatcher(() =>
                        {
                            ProgressValue = (int)((System.Math.Round(++completeCount / totalCompareCount, 2)) * 100);
                        });
                    }
                }

                ShowMessageOkOnly("결과메시지", "중복 이미지 검색을 마쳤습니다.");
                Enabled = true;
            }
        }