public void TestFilter()
        {
            SmoothingFilter filter = new SmoothingFilter(FilterConfig.Config1);
            Bitmap          bmp    = CreateScene1().Draw(renderer, resolution);

            bmp = filter.Filter(bmp);
            Save(bmp);
        }
Beispiel #2
0
        public override void Compute()
        {
            TermDocumentMatrix sourceArtifacts = SmoothingFilter.Compute(new TermDocumentMatrix((TLArtifactsCollection)Workspace.Load("SourceArtifacts")));
            TermDocumentMatrix targetArtifacts = SmoothingFilter.Compute(new TermDocumentMatrix((TLArtifactsCollection)Workspace.Load("TargetArtifacts")));
            TLSimilarityMatrix sims            = VSM.Compute(sourceArtifacts, targetArtifacts);

            Workspace.Store("Similarities", sims);
        }
Beispiel #3
0
        public override void Compute()
        {
            TLArtifactsCollection sourceArtifacts = (TLArtifactsCollection)Workspace.Load("SourceArtifacts");
            TLArtifactsCollection targetArtifacts = (TLArtifactsCollection)Workspace.Load("TargetArtifacts");
            TermDocumentMatrix    matrix          = new TermDocumentMatrix(sourceArtifacts, targetArtifacts);

            matrix = SmoothingFilter.Compute(matrix, sourceArtifacts.Keys);
            matrix = SmoothingFilter.Compute(matrix, targetArtifacts.Keys);
            TLSimilarityMatrix sims = SimilarityUtil.ComputeCosine(matrix, sourceArtifacts.Keys, targetArtifacts.Keys);

            Workspace.Store("Similarities", sims);
        }
Beispiel #4
0
        public async void SmoothingFilterButton()
        {
            var metroWindow = Application.Current.MainWindow as MetroWindow;
            var controller  = await metroWindow.ShowProgressAsync("Proszę czekać...", "Trwa przetwarzanie obrazu");

            controller.SetCancelable(false);
            controller.SetIndeterminate();

            var smoothingFilter = new SmoothingFilter();
            var newBitmap       = smoothingFilter.ExecuteFilter(this.ConvertFromBitmapImageToBitmap(this.DisplayedImage));

            this.DisplayedImage = this.ConvertFromBitmapToBitmapImage(newBitmap);

            await controller.CloseAsync();
        }
        public void UpdatePipeline(PathPointLayout layout, Calculator calculator, float spacing)
        {
            bool layoutChanged = false;
            bool otherChange   = false;

            if ((Layout == null) || (layout.ChannelMask != Layout.ChannelMask))
            {
                Layout        = layout;
                layoutChanged = true;
            }

            if (mPathProducer == null || calculator != mPathProducer.PathPointCalculator || layoutChanged)
            {
                mPathProducer = new PathProducer(Layout, calculator, true);
                otherChange   = true;
            }

            if (mSmoothingFilter == null || layoutChanged)
            {
                mSmoothingFilter = new SmoothingFilter(Layout.Count)
                {
                    KeepAllData = true
                };
                otherChange = true;
            }

            if (SplineProducer == null || layoutChanged)
            {
                SplineProducer = new SplineProducer(Layout, true);
                otherChange    = true;
            }

            if (SplineInterpolator == null || layoutChanged)
            {
                SplineInterpolator = new DistanceBasedInterpolator(Layout, spacing, splitCount, true, true, true);
                otherChange        = true;
            }
            ((DistanceBasedInterpolator)SplineInterpolator).Spacing = spacing;

            if (layoutChanged || otherChange)
            {
                LayoutUpdated?.Invoke(this, EventArgs.Empty);
            }
        }
        public void UpdatePipeline(PathPointLayout layout, Calculator calculator, VectorBrush brush)
        {
            bool layoutChanged = false;

            if ((Layout == null) || (layout.ChannelMask != Layout.ChannelMask))
            {
                Layout        = layout;
                layoutChanged = true;
            }

            if (mPathProducer == null || calculator != mPathProducer.PathPointCalculator || layoutChanged)
            {
                mPathProducer = new PathProducer(Layout, calculator)
                {
                    KeepAllData = true
                };
            }

            if (mSmoothingFilter == null || layoutChanged)
            {
                mSmoothingFilter = new SmoothingFilter(Layout.Count)
                {
                    KeepAllData = true
                };
            }

            if (SplineProducer == null || layoutChanged)
            {
                SplineProducer = new SplineProducer(Layout)
                {
                    KeepAllData = true
                };
            }

            if (SplineInterpolator == null || layoutChanged)
            {
                SplineInterpolator = new CurvatureBasedInterpolator(Layout)
                {
                    KeepAllData = true
                };
            }

            if (BrushApplier == null || (brush != BrushApplier.Prototype) || layoutChanged)
            {
                BrushApplier = new BrushApplier(Layout, brush)
                {
                    KeepAllData = true
                };
            }

            if (ConvexHullChainProducer == null)
            {
                ConvexHullChainProducer = new ConvexHullChainProducer()
                {
                    KeepAllData = true
                };
            }

            if (mPolygonMerger == null)
            {
                mPolygonMerger = new PolygonMerger()
                {
                    KeepAllData = true
                };
            }

            if (PolygonSimplifier == null)
            {
                PolygonSimplifier = new PolygonSimplifier(0.1f)
                {
                    KeepAllData = true
                };
            }
        }