/// <summary>
        /// Initializes a new instance of the <see cref="NSColoredCannyForm"/> class.
        /// </summary>
        /// <param name="processor">The SBIP processor.</param>
        public NSColoredCannyForm(Processor processor)
        {
            InitializeComponent();

            Processor = processor;
            canny = new NSCannyEdgeDetector();
            dilatation = new NSSimpleDilatation();

            // TODO FF: Delete this region
            #region Pre-Configure
            //trbarWeight.Value = 20;
            //trbarMinContourSize.Value = 300;
            //trbarTraceRadius.Value = 10;
            //chboxDrawBorderLine.Checked = true;

            //trbarHighThreshold.Value = 20;
            //trbarLowThreshold.Value = 10;
            //trbarGaussSize.Value = 5;
            //trbarGaussSigma.Value = (int)(1.631 * 1000 + 0.1);
            #endregion Pre-Configure
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="NSAbstractEdgeMarker"/> class.
 /// </summary>
 protected NSAbstractEdgeMarker()
 {
     SupportedSrcPixelFormats = PixelFormatFlags.All;
     SimpleDilatation = new NSSimpleDilatation();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="NSAbstractEdgeMarker"/> class.
 /// </summary>
 protected NSAbstractEdgeMarker()
 {
     SupportedSrcPixelFormats = PixelFormatFlags.All;
     SimpleDilatation         = new NSSimpleDilatation();
 }
Example #4
0
        private void BtnProcessClick(object sender, EventArgs e)
        {
            EndlessProgressBarFormInThread form =
                new EndlessProgressBarFormInThread(
                    "Do Contour Tracing ... ",
                    "Please wait, this takes a few seconds.");
            form.Start();

            try
            {
                Bitmap b;

                // Todo FF: Hack for rectangle border and dilatation
                if (doDilatation)
                {
                    int tmp = conGrap.LineRectStrength;
                    conGrap.LineRectStrength = 1;
                    b = conGrap.Apply(Processor.OriginalImage);
                    conGrap.LineRectStrength = tmp;

                    NSSimpleDilatation dilatation = new NSSimpleDilatation();
                    for (int i = 0; i < conGrap.LineRectStrength; i++)
                    {
                        b = dilatation.Apply(b);
                    }
                }
                else
                {
                    b = conGrap.Apply(Processor.OriginalImage);
                }

                ColorPalette.SetColorPalette(b);
                Processor.Change(b);
                lbContourNumbers.Text = conGrap.Contours.Count.ToString(
                    CultureInfo.InvariantCulture);
            }
            catch (ArgumentException aex)
            {
                MessageBox.Show(aex.Message);
                BtnResetClick(sender, e);
            }

            form.End();
        }