Esempio n. 1
0
        /// <summary>
        /// For bitton "Compute more steps".
        /// Method starts computing more steps of edge relaxation algorithm.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MultipleEdgeRelaxationInImage(object sender, EventArgs e)
        {
            if (firstLoop == false)
            {
                MessageBox.Show("No preprocessing for edge relaxation.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            try
            {
                int numberOfLoops = int.Parse(loops.Text);

                if (numberOfLoops <= 0)
                {
                    MessageBox.Show("Number of loops must be greater than zero.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                if (newRelax != null)
                {
                    oldRelax = (Bitmap)newRelax.Clone();
                }

                newRelax = EdgeRelaxation.EdgeRelaxationLoop(numberOfLoops);
                invalidateNewImage(newRelax);
            }
            catch
            {
                MessageBox.Show("Count of loops must be a number.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// For button "One more step".
        /// Method starts computing one loop of edge relaxation algorithm.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SingleEdgeRelaxationInImage(object sender, EventArgs e)
        {
            if (firstLoop == false)
            {
                MessageBox.Show("No preprocessing for edge relaxation.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (newRelax != null)
            {
                oldRelax = (Bitmap)newRelax.Clone();
            }

            newRelax = EdgeRelaxation.EdgeRelaxationLoop(1);
            invalidateNewImage(newRelax);
        }
Esempio n. 3
0
        /// <summary>
        /// For button "Edge relaxation".
        /// Method starts edge relaxation algorithm. It is necessarily to run this method firts because it launches the firts step,
        /// normalization of gradient values for each pixel.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void StartEdgeRelaxation(object sender, EventArgs e)
        {
            if (firstLoop == true)
            {
                MessageBox.Show("Load new image.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (openedImage == null)
            {
                MessageBox.Show("No image for edge relaxation.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (newRelax != null)
            {
                oldRelax = (Bitmap)newRelax.Clone();
            }

            newRelax = EdgeRelaxation.EdgeRelaxationFirstLoop(openedImage, axis, operatorIndex);
            invalidateNewImage(newRelax);
            firstLoop = true;
        }