Example #1
0
        private void BilateralFilter(object sender, ExecutedRoutedEventArgs e)
        {
            int maxSize = ImageHelper.DipLibImage.PixelHeight < ImageHelper.DipLibImage.PixelWidth
                ? ImageHelper.DipLibImage.PixelHeight
                : ImageHelper.DipLibImage.PixelWidth;
            var dialog = new InputDialog(new List <dynamic>
            {
                new IntInputItem()
                {
                    Label         = "滤波器大小",
                    Minimum       = 3,
                    Value         = 3,
                    Maximum       = maxSize,
                    SmallChange   = 1,
                    LargeChange   = 1,
                    TickFrequency = maxSize / 10,
                },
                new DoubleInputItem()
                {
                    Label          = "平滑参数 - 距离",
                    Value          = 1,
                    Minimum        = 0,
                    Maximum        = 1000,
                    SmallChange    = 1,
                    LargeChange    = 10,
                    TickFrequency  = 100,
                    FractionDigits = 2
                },
                new DoubleInputItem()
                {
                    Label          = "平滑参数 - 像素差值",
                    Value          = 1,
                    Minimum        = 0,
                    Maximum        = 1000,
                    SmallChange    = 1,
                    LargeChange    = 10,
                    TickFrequency  = 100,
                    FractionDigits = 2
                },
            });

            if (!dialog.ShowDialog().Value)
            {
                return;
            }
            int    size = ((IntInputItem)dialog.InputItems[0]).Value;
            double d    = ((DoubleInputItem)dialog.InputItems[1]).Value;
            double r    = ((DoubleInputItem)dialog.InputItems[2]).Value;

            ImageHelper.BilateralFilter(size, d, r);
        }
Example #2
0
        public void Rotate(object sender, ExecutedRoutedEventArgs e)
        {
            var dialog = new InputDialog(new List <dynamic>
            {
                new IntInputItem()
                {
                    Label         = "中心点横坐标",
                    Maximum       = ImageHelper.Image.PixelWidth - 1,
                    Value         = (ImageHelper.Image.PixelWidth - 1) / 2,
                    SmallChange   = 10,
                    LargeChange   = 100,
                    TickFrequency = 50,
                },
                new IntInputItem()
                {
                    Label         = "中心点纵坐标",
                    Maximum       = ImageHelper.Image.PixelHeight - 1,
                    Value         = (ImageHelper.Image.PixelHeight - 1) / 2,
                    SmallChange   = 10,
                    LargeChange   = 100,
                    TickFrequency = 50,
                },
                new DoubleInputItem()
                {
                    Label          = "旋转角度",
                    Minimum        = -180,
                    Maximum        = 180,
                    SmallChange    = 1,
                    LargeChange    = 10,
                    TickFrequency  = 30,
                    FractionDigits = 2
                }
            });

            if (!dialog.ShowDialog().Value)
            {
                return;
            }
            int    originX = (dialog.InputItems[0] as IntInputItem).Value;
            int    originY = (dialog.InputItems[1] as IntInputItem).Value;
            double angle   = (dialog.InputItems[2] as DoubleInputItem).Value;

            ImageHelper.RotateD(originX, originY, angle);
        }
Example #3
0
        public void ScaleWithBi(object sender, ExecutedRoutedEventArgs e)
        {
            var dialog = new InputDialog(new List <dynamic>
            {
                new DoubleInputItem()
                {
                    Label          = "水平缩放",
                    Value          = 2,
                    Minimum        = 1,
                    Maximum        = 10,
                    SmallChange    = 0.1,
                    LargeChange    = 1,
                    TickFrequency  = 1,
                    FractionDigits = 2
                },
                new DoubleInputItem()
                {
                    Label          = "垂直缩放",
                    Value          = 2,
                    Minimum        = 1,
                    Maximum        = 10,
                    SmallChange    = 0.1,
                    LargeChange    = 1,
                    TickFrequency  = 1,
                    FractionDigits = 2
                },
            });

            if (!dialog.ShowDialog().Value)
            {
                return;
            }
            double kx = ((DoubleInputItem)dialog.InputItems[0]).Value;
            double ky = ((DoubleInputItem)dialog.InputItems[1]).Value;

            ImageHelper.ScaleWithBi(kx, ky);
        }
Example #4
0
        private void MeanFilter(object sender, ExecutedRoutedEventArgs e)
        {
            var dialog = new InputDialog(new List <dynamic>
            {
                new IntInputItem()
                {
                    Label         = "滤波器大小",
                    Minimum       = 1,
                    Value         = 3,
                    Maximum       = 10,
                    SmallChange   = 1,
                    LargeChange   = 1,
                    TickFrequency = 1,
                },
            });

            if (!dialog.ShowDialog().Value)
            {
                return;
            }
            int size = ((IntInputItem)dialog.InputItems[0]).Value;

            ImageHelper.MeanFilter(size);
        }