Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SixParamsConfigForm"/> class.
        /// </summary>
        /// <param name="viewer">The image viewer for image preview.</param>
        /// <param name="dialogName">Dialog name.</param>
        /// <param name="parameter1">First image processing parameter.</param>
        /// <param name="parameter2">Second image processing parameter.</param>
        /// <param name="parameter3">Third image processing parameter.</param>
        /// <param name="parameter4">Fourth image processing parameter.</param>
        /// <param name="parameter5">Fifth image processing parameter.</param>
        /// <param name="parameter6">Sixth image processing parameter.</param>
        public SixParamsConfigForm(
            ImageViewer viewer,
            string dialogName,
            ImageProcessingParameter parameter1,
            ImageProcessingParameter parameter2,
            ImageProcessingParameter parameter3,
            ImageProcessingParameter parameter4,
            ImageProcessingParameter parameter5,
            ImageProcessingParameter parameter6)
            : base(viewer)
        {
            InitializeComponent();

            _initialParameter1 = parameter1;
            _initialParameter2 = parameter2;
            _initialParameter3 = parameter3;
            _initialParameter4 = parameter4;
            _initialParameter5 = parameter5;
            _initialParameter6 = parameter6;

            Text = dialogName;

            valueEditorControl1.ValueName    = parameter1.Name;
            valueEditorControl1.MinValue     = parameter1.MinValue;
            valueEditorControl1.MaxValue     = parameter1.MaxValue;
            valueEditorControl1.DefaultValue = parameter1.DefaultValue;
            valueEditorControl1.Value        = parameter1.DefaultValue;

            valueEditorControl2.ValueName    = parameter2.Name;
            valueEditorControl2.MinValue     = parameter2.MinValue;
            valueEditorControl2.MaxValue     = parameter2.MaxValue;
            valueEditorControl2.DefaultValue = parameter2.DefaultValue;
            valueEditorControl2.Value        = parameter2.DefaultValue;

            valueEditorControl3.ValueName    = parameter3.Name;
            valueEditorControl3.MinValue     = parameter3.MinValue;
            valueEditorControl3.MaxValue     = parameter3.MaxValue;
            valueEditorControl3.DefaultValue = parameter3.DefaultValue;
            valueEditorControl3.Value        = parameter3.DefaultValue;

            valueEditorControl4.ValueName    = parameter4.Name;
            valueEditorControl4.MinValue     = parameter4.MinValue;
            valueEditorControl4.MaxValue     = parameter4.MaxValue;
            valueEditorControl4.DefaultValue = parameter4.DefaultValue;
            valueEditorControl4.Value        = parameter4.DefaultValue;

            valueEditorControl5.ValueName    = parameter5.Name;
            valueEditorControl5.MinValue     = parameter5.MinValue;
            valueEditorControl5.MaxValue     = parameter5.MaxValue;
            valueEditorControl5.DefaultValue = parameter5.DefaultValue;
            valueEditorControl5.Value        = parameter5.DefaultValue;

            valueEditorControl6.ValueName    = parameter6.Name;
            valueEditorControl6.MinValue     = parameter6.MinValue;
            valueEditorControl6.MaxValue     = parameter6.MaxValue;
            valueEditorControl6.DefaultValue = parameter6.DefaultValue;
            valueEditorControl6.Value        = parameter6.DefaultValue;

            previewCheckBox.Checked = IsPreviewEnabled;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="TwoParamsConfigForm"/> class.
        /// </summary>
        /// <param name="viewer">The image viewer for image preview.</param>
        /// <param name="dialogName">Dialog name.</param>
        /// <param name="parameter1">First image processing parameter.</param>
        /// <param name="parameter2">Second image processing parameter.</param>
        public TwoParamsConfigForm(
            ImageViewer viewer,
            string dialogName,
            ImageProcessingParameter parameter1,
            ImageProcessingParameter parameter2)
            : base(viewer)
        {
            InitializeComponent();

            Text = dialogName;

            _initialParameter1 = parameter1;
            _initialParameter2 = parameter2;

            valueEditorControl1.ValueName    = parameter1.Name;
            valueEditorControl1.MinValue     = parameter1.MinValue;
            valueEditorControl1.MaxValue     = parameter1.MaxValue;
            valueEditorControl1.DefaultValue = parameter1.DefaultValue;
            valueEditorControl1.Value        = parameter1.DefaultValue;

            valueEditorControl2.ValueName    = parameter2.Name;
            valueEditorControl2.MinValue     = parameter2.MinValue;
            valueEditorControl2.MaxValue     = parameter2.MaxValue;
            valueEditorControl2.DefaultValue = parameter2.DefaultValue;
            valueEditorControl2.Value        = parameter2.DefaultValue;

            previewCheckBox.Checked = IsPreviewEnabled;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="OneParamConfigForm"/> class.
        /// </summary>
        /// <param name="viewer">The image viewer for image preview.</param>
        /// <param name="dialogName">Dialog name.</param>
        /// <param name="parameter1">Image processing parameter.</param>
        public OneParamConfigForm(ImageViewer viewer, string dialogName, ImageProcessingParameter parameter1)
            : base(viewer)
        {
            InitializeComponent();

            Text = dialogName;

            _initialParameter1       = parameter1;
            valueEditor.ValueName    = parameter1.Name;
            valueEditor.MinValue     = parameter1.MinValue;
            valueEditor.MaxValue     = parameter1.MaxValue;
            valueEditor.DefaultValue = parameter1.DefaultValue;
            valueEditor.Value        = parameter1.DefaultValue;
            previewCheckBox.Checked  = IsPreviewEnabled;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CannyEdgeDetectorForm"/> class.
        /// </summary>
        /// <param name="viewer">The image viewer for image preview.</param>
        public CannyEdgeDetectorForm(ImageViewer viewer)
            : base(viewer)
        {
            InitializeComponent();

            _initialParameter1 = new ImageProcessingParameter("Blur radius", 1, 15, 3);
            _initialParameter2 = new ImageProcessingParameter("High threshold", 0, 255, 80);
            _initialParameter3 = new ImageProcessingParameter("Low threshold", 0, 255, 20);

            groupBox1.Text         = _initialParameter1.Name;
            trackBar1.Minimum      = _initialParameter1.MinValue;
            trackBar1.Maximum      = _initialParameter1.MaxValue;
            trackBar1.Value        = _initialParameter1.DefaultValue;
            numericUpDown1.Minimum = _initialParameter1.MinValue;
            numericUpDown1.Maximum = _initialParameter1.MaxValue;
            numericUpDown1.Value   = _initialParameter1.DefaultValue;
            minValueLabel1.Text    = _initialParameter1.MinValue.ToString(System.Globalization.CultureInfo.InvariantCulture);
            maxValueLabel1.Text    = _initialParameter1.MaxValue.ToString(System.Globalization.CultureInfo.InvariantCulture);

            groupBox2.Text         = _initialParameter2.Name;
            trackBar2.Minimum      = _initialParameter2.MinValue;
            trackBar2.Maximum      = _initialParameter2.MaxValue;
            trackBar2.Value        = _initialParameter2.DefaultValue;
            numericUpDown2.Minimum = _initialParameter2.MinValue;
            numericUpDown2.Maximum = _initialParameter2.MaxValue;
            numericUpDown2.Value   = _initialParameter2.DefaultValue;
            minValueLabel2.Text    = trackBar2.Minimum.ToString(System.Globalization.CultureInfo.InvariantCulture);
            maxValueLabel2.Text    = trackBar2.Maximum.ToString(System.Globalization.CultureInfo.InvariantCulture);

            groupBox3.Text         = _initialParameter3.Name;
            trackBar3.Minimum      = _initialParameter3.MinValue;
            trackBar3.Maximum      = _initialParameter2.DefaultValue;
            trackBar3.Value        = _initialParameter3.DefaultValue;
            numericUpDown3.Minimum = _initialParameter3.MinValue;
            numericUpDown3.Maximum = _initialParameter3.MaxValue;
            numericUpDown3.Value   = _initialParameter3.DefaultValue;
            minValueLabel3.Text    = trackBar3.Minimum.ToString(System.Globalization.CultureInfo.InvariantCulture);
            maxValueLabel3.Text    = trackBar3.Maximum.ToString(System.Globalization.CultureInfo.InvariantCulture);

            previewCheckBox.Checked = IsPreviewEnabled;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="HalftoneRemovalForm"/> class.
        /// </summary>
        /// <param name="viewer">The image viewer for image preview.</param>
        public HalftoneRemovalForm(ImageViewer viewer)
            : base(viewer)
        {
            InitializeComponent();

            ImageProcessingParameter parameter1 = new ImageProcessingParameter("Max segment size", 2, 50, 10);
            ImageProcessingParameter parameter2 = new ImageProcessingParameter("Cell size", 10, 500, 20);
            ImageProcessingParameter parameter3 = new ImageProcessingParameter("Min halftone width", 10, 500, 25);
            ImageProcessingParameter parameter4 = new ImageProcessingParameter("Min halftone height", 10, 500, 25);
            ImageProcessingParameter parameter5 = new ImageProcessingParameter("Black pixel removal threshold", 0, 100, 33);
            ImageProcessingParameter parameter6 = new ImageProcessingParameter("White pixel removal threshold", 0, 100, 33);

            _initialParameter1 = parameter1;
            _initialParameter2 = parameter2;
            _initialParameter3 = parameter3;
            _initialParameter4 = parameter4;
            _initialParameter5 = parameter5;
            _initialParameter6 = parameter6;

            Text = "Halftone removal";

            groupBox1.Text         = parameter1.Name;
            trackBar1.Minimum      = parameter1.MinValue;
            trackBar1.Maximum      = parameter1.MaxValue;
            trackBar1.Value        = parameter1.DefaultValue;
            numericUpDown1.Minimum = parameter1.MinValue;
            numericUpDown1.Maximum = parameter1.MaxValue;
            numericUpDown1.Value   = parameter1.DefaultValue;
            minValueLabel1.Text    = parameter1.MinValue.ToString(System.Globalization.CultureInfo.InvariantCulture);
            maxValueLabel1.Text    = parameter1.MaxValue.ToString(System.Globalization.CultureInfo.InvariantCulture);

            groupBox2.Text         = parameter2.Name;
            trackBar2.Minimum      = parameter2.MinValue;
            trackBar2.Maximum      = parameter2.MaxValue;
            trackBar2.Value        = parameter2.DefaultValue;
            numericUpDown2.Minimum = parameter2.MinValue;
            numericUpDown2.Maximum = parameter2.MaxValue;
            numericUpDown2.Value   = parameter2.DefaultValue;
            minValueLabel2.Text    = parameter2.MinValue.ToString(System.Globalization.CultureInfo.InvariantCulture);
            maxValueLabel2.Text    = parameter2.MaxValue.ToString(System.Globalization.CultureInfo.InvariantCulture);

            groupBox3.Text         = parameter3.Name;
            trackBar3.Minimum      = parameter3.MinValue;
            trackBar3.Maximum      = parameter3.MaxValue;
            trackBar3.Value        = parameter3.DefaultValue;
            numericUpDown3.Minimum = parameter3.MinValue;
            numericUpDown3.Maximum = parameter3.MaxValue;
            numericUpDown3.Value   = parameter3.DefaultValue;
            minValueLabel3.Text    = parameter3.MinValue.ToString(System.Globalization.CultureInfo.InvariantCulture);
            maxValueLabel3.Text    = parameter3.MaxValue.ToString(System.Globalization.CultureInfo.InvariantCulture);

            groupBox4.Text         = parameter4.Name;
            trackBar4.Minimum      = parameter4.MinValue;
            trackBar4.Maximum      = parameter4.MaxValue;
            trackBar4.Value        = parameter4.DefaultValue;
            numericUpDown4.Minimum = parameter4.MinValue;
            numericUpDown4.Maximum = parameter4.MaxValue;
            numericUpDown4.Value   = parameter4.DefaultValue;
            minValueLabel4.Text    = parameter4.MinValue.ToString(System.Globalization.CultureInfo.InvariantCulture);
            maxValueLabel4.Text    = parameter4.MaxValue.ToString(System.Globalization.CultureInfo.InvariantCulture);

            autoThresholdCheckBox.Checked = false;

            groupBox5.Text         = parameter5.Name;
            trackBar5.Minimum      = parameter5.MinValue;
            trackBar5.Maximum      = parameter5.MaxValue;
            trackBar5.Value        = parameter5.DefaultValue;
            numericUpDown5.Minimum = parameter5.MinValue;
            numericUpDown5.Maximum = parameter5.MaxValue;
            numericUpDown5.Value   = parameter5.DefaultValue;
            minValueLabel5.Text    = parameter5.MinValue.ToString(System.Globalization.CultureInfo.InvariantCulture);
            maxValueLabel5.Text    = parameter5.MaxValue.ToString(System.Globalization.CultureInfo.InvariantCulture);

            groupBox6.Text         = parameter6.Name;
            trackBar6.Minimum      = parameter6.MinValue;
            trackBar6.Maximum      = parameter6.MaxValue;
            trackBar6.Value        = parameter6.DefaultValue;
            numericUpDown6.Minimum = parameter6.MinValue;
            numericUpDown6.Maximum = parameter6.MaxValue;
            numericUpDown6.Value   = parameter6.DefaultValue;
            minValueLabel6.Text    = parameter6.MinValue.ToString(System.Globalization.CultureInfo.InvariantCulture);
            maxValueLabel6.Text    = parameter6.MaxValue.ToString(System.Globalization.CultureInfo.InvariantCulture);

            previewCheckBox.Checked = IsPreviewEnabled;
        }