Exemplo n.º 1
0
        /// <summary>
        /// Similarity value adjustment
        /// </summary>
        private void trackBarSimilarity_Scroll(object sender, EventArgs e)
        {
            TrackBar ctrl = (TrackBar)sender;

            toolTipValue.SetToolTip(ctrl, ctrl.Value.ToString());

            if (picOutput.Image != null)
            {
                picOutput.Image.Dispose();
            }
            if (rdbSimRGB.Checked)
            {
                picOutput.Image = TakakuraImplement.Similiar_RGB((Bitmap)picInput.Image, _rect, rgbs, trackBarSimilarity.Value);
            }
            else if (rdbSimRGBAver.Checked)
            {
                picOutput.Image = TakakuraImplement.Similiar_RGBAver((Bitmap)picInput.Image, _rect, rgbs, trackBarSimilarity.Value);
            }
            else if (rdbSimLAB.Checked)
            {
                picOutput.Image = TakakuraImplement.Similiar_LAB((Bitmap)picInput.Image, _rect, labs, trackBarSimilarity.Value);
            }
            else if (rdbSimLABAver.Checked)
            {
                picOutput.Image = TakakuraImplement.Similiar_LABAver((Bitmap)picInput.Image, _rect, labs, trackBarSimilarity.Value);
            }
            else if (rdbSimHSV.Checked)
            {
                picOutput.Image = TakakuraImplement.Similiar_HSV((Bitmap)picInput.Image, _rect, hsvs, trackBarSimilarity.Value);
            }
            else if (picInput.Image != null)
            {
                picOutput.Image = (Bitmap)picInput.Image.Clone();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Image processing
        /// </summary>
        private void rdbProc_CheckedChanged(object sender, EventArgs e)
        {
            _changed = !_changed;
            if (_changed)
            {
                return;
            }

            if (picOutput.Image != null)
            {
                picOutput.Image.Dispose();
            }
            if (rdbProcPseudoColor.Checked)
            {
                picOutput.Image = TakakuraImplement.PseudoColorFilter((Bitmap)picInput.Image, _rect);
            }
            else if (rdbProcHSVStretch.Checked)
            {
                picOutput.Image = TakakuraImplement.HistogramStretchHSV((Bitmap)picInput.Image, _rect);
            }
            else if (rdbProcRGBStretch.Checked)
            {
                picOutput.Image = TakakuraImplement.HistogramStretchRGB((Bitmap)picInput.Image, _rect);
            }
            else if (!_leave && picInput.Image != null)
            {
                picOutput.Image = (Bitmap)picInput.Image.Clone();
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Get pixel
        /// </summary>
        private void picInput_MouseMove(object sender, MouseEventArgs e)
        {
            Graphics g   = picInput.CreateGraphics();
            Bitmap   img = (Bitmap)picInput.Image;
            Point    pix = new Point();

            if (e.Button == MouseButtons.Left && !rdbSimNone.Checked)
            {
                g.DrawEllipse(Pens.Red, e.X, e.Y, 1, 1);
                pix = TransformPosition(img, e.Location);
                rgb = new RGB(img.GetPixel(pix.X, pix.Y));
                lab = LAB.FromRGB(rgb);
                hsv = HSV.FromRGB(rgb);
                rgbs.Add(rgb);
                labs.Add(lab);
                hsvs.Add(hsv);

                if (picOutput.Image != null)
                {
                    picOutput.Image.Dispose();
                }

                if (rdbSimRGB.Checked)
                {
                    picOutput.Image = TakakuraImplement.Similiar_RGB((Bitmap)picInput.Image, _rect, rgbs, trackBarSimilarity.Value);
                }
                else if (rdbSimRGBAver.Checked)
                {
                    picOutput.Image = TakakuraImplement.Similiar_RGBAver((Bitmap)picInput.Image, _rect, rgbs, trackBarSimilarity.Value);
                }
                else if (rdbSimLAB.Checked)
                {
                    picOutput.Image = TakakuraImplement.Similiar_LAB((Bitmap)picInput.Image, _rect, labs, trackBarSimilarity.Value);
                }
                else if (rdbSimLABAver.Checked)
                {
                    picOutput.Image = TakakuraImplement.Similiar_LABAver((Bitmap)picInput.Image, _rect, labs, trackBarSimilarity.Value);
                }
                else
                {
                    picOutput.Image = TakakuraImplement.Similiar_HSV((Bitmap)picInput.Image, _rect, hsvs, trackBarSimilarity.Value);
                }
            }
            g.Dispose();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Similarity selection
        /// </summary>
        private void rdbSimilarity_CheckedChanged(object sender, EventArgs e)
        {
            _changed = !_changed;
            if (_changed)
            {
                return;
            }

            if (picOutput.Image != null)
            {
                picOutput.Image.Dispose();
            }
            if (rdbSimRGB.Checked)
            {
                picOutput.Image = TakakuraImplement.Similiar_RGB((Bitmap)picInput.Image, _rect, rgbs, trackBarSimilarity.Value);
            }
            else if (rdbSimRGBAver.Checked)
            {
                picOutput.Image = TakakuraImplement.Similiar_RGBAver((Bitmap)picInput.Image, _rect, rgbs, trackBarSimilarity.Value);
            }
            else if (rdbSimLAB.Checked)
            {
                picOutput.Image = TakakuraImplement.Similiar_LAB((Bitmap)picInput.Image, _rect, labs, trackBarSimilarity.Value);
            }
            else if (rdbSimLABAver.Checked)
            {
                picOutput.Image = TakakuraImplement.Similiar_LABAver((Bitmap)picInput.Image, _rect, labs, trackBarSimilarity.Value);
            }
            else if (rdbSimHSV.Checked)
            {
                picOutput.Image = TakakuraImplement.Similiar_HSV((Bitmap)picInput.Image, _rect, hsvs, trackBarSimilarity.Value);
            }
            else if (!_leave && picInput.Image != null)
            {
                picOutput.Image = (Bitmap)picInput.Image.Clone();
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Binarization method selection
        /// </summary>
        private void rdbBinarization_CheckedChanged(object sender, EventArgs e)
        {
            _changed = !_changed;
            if (_changed)
            {
                return;
            }

            lblThreshold.Enabled      = false;
            trackBarThreshold.Enabled = false;

            if (picOutput.Image != null)
            {
                picOutput.Image.Dispose();
            }

            if (rdbBinDA.Checked)
            {
                picOutput.Image = TakakuraImplement.DiscriminantAnalysis((Bitmap)picInput.Image, _rect);
            }
            else if (rdbBinSIS.Checked)
            {
                picOutput.Image = Binarization.SISThreshold((Bitmap)picInput.Image, _rect);
            }
            else if (rdbBinOtsu.Checked)
            {
                picOutput.Image = Binarization.OtsuThreshold((Bitmap)picInput.Image, _rect);
            }
            else if (rdbBinLi.Checked)
            {
                picOutput.Image = Binarization.LiThreshold((Bitmap)picInput.Image, _rect);
            }
            else if (rdbBinHuang.Checked)
            {
                picOutput.Image = Binarization.HuangThreshold((Bitmap)picInput.Image, _rect);
            }
            else if (rdbBinYen.Checked)
            {
                picOutput.Image = Binarization.YenThreshold((Bitmap)picInput.Image, _rect);
            }
            else if (rdbBinMean.Checked)
            {
                picOutput.Image = Binarization.MeanThreshold((Bitmap)picInput.Image, _rect);
            }
            else if (rdbBinPercentile.Checked)
            {
                picOutput.Image = Binarization.PercentileThreshold((Bitmap)picInput.Image, _rect);
            }
            else if (rdbBinIterative.Checked)
            {
                picOutput.Image = Binarization.IteractiveThreshold((Bitmap)picInput.Image, _rect, 0, 180);
            }
            else if (rdbBinMoments.Checked)
            {
                picOutput.Image = Binarization.MomentsThreshold((Bitmap)picInput.Image, _rect);
            }
            else if (rdbBinIsoData.Checked)
            {
                picOutput.Image = Binarization.IsoDataThreshold((Bitmap)picInput.Image, _rect);
            }
            else if (rdbBinAdjust.Checked)
            {
                lblThreshold.Enabled      = true;
                trackBarThreshold.Enabled = true;
                picOutput.Image           = Binarization.Threshold((Bitmap)picInput.Image, _rect, trackBarThreshold.Value);
            }
            else if (!_leave && picInput.Image != null)
            {
                picOutput.Image = (Bitmap)picInput.Image.Clone();
            }
        }