void ChangeFront2ImgProcStep()
        {
            btnStartProcssing.IsEnabled = true;
            Removeevent(CornerCanvs);
            ClearLRFrame();
            while (canvas.Children.Count > 0)
            {
                canvas.Children.RemoveAt(canvas.Children.Count - 1);
            }                                                                                              // delect rect
            titleRB.Text = "Histogram";
            titleLT.Text = "Indexing View";

            Core.CreateEstedChipFunc(Core.PData.CornerPos_Img, ckbEst4Pos.IsChecked.Value ? EstChipPosMode.With4Point : EstChipPosMode.With2Point);

            Core.IndexViewImg      = new Image <Bgr, byte>(Core.PData.ChipWNum, Core.PData.ChipHNum);
            Core.IndexViewImg.Data = MatPattern(Core.PData.ChipHNum, Core.PData.ChipWNum, 3);
            imgIndex.ImageSource   = BitmapSrcConvert.ToBitmapSource(Core.IndexViewImg);
            imgRB.ImageSource      = null;

            WinHost  = CreateWinHost(canvasLT);
            HistoBox = new HistogramBox();

            canvasRB.Children.Clear();
            AddHist2Box(HistoBox, ref HistogramList, HistoFromImage(Core.OriginImg, Core.BinSize),
                        ( bool )ckbSetHistRange.IsChecked ? float.Parse(nudHistDW.Text) : 0,
                        ( bool )ckbSetHistRange.IsChecked ? float.Parse(nudHistUP.Text) : 255);
            HistoBox.Refresh();
            WinHost.Child = HistoBox;
            canvasRB.Children.Add(WinHost);
        }
示例#2
0
        void ChangeFront2ImgProcStep()
        {
            btnStartProcssing.IsEnabled = true;
            Removeevent(canvasLT, canvasRB);
            ClearLRFrame();
            while (canvas.Children.Count > 0)
            {
                canvas.Children.RemoveAt(canvas.Children.Count - 1);
            }                                                                                              // delect rect
            titleRB.Text = "Histogram";
            titleLT.Text = "Indexing View";

            Core.EstedChipPos = ImgPFunc.FnCreateEstedChipPos((Core.PData.EndImgPos[1] - Core.PData.StrImgPos[1]),
                                                              (Core.PData.EndImgPos[0] - Core.PData.StrImgPos[0]),
                                                              Core.PData.StrImgPos[1], Core.PData.StrImgPos[0]);
            Core.IndexViewImg      = new Image <Bgr, byte>(Core.PData.ChipWNum, Core.PData.ChipHNum);
            Core.IndexViewImg.Data = MatPattern(Core.PData.ChipHNum, Core.PData.ChipWNum, 3);
            imgLT.ImageSource      = BitmapSourceConvert.ToBitmapSource(Core.IndexViewImg);
            imgRB.ImageSource      = null;


            var passfun = curry(HistoFromImage(Core.BinSize))(Core.OriginImg); // Passing Form

            WinHost  = CreateWinHost(canvasLT);
            HistoBox = new HistogramBox();

            canvasRB.Children.Clear();

            AddHist2Box(HistoBox, HistogramList, passfun,
                        ( bool )ckbSetHistRange.IsChecked ? float.Parse(nudHistDW.Text) : 0,
                        ( bool )ckbSetHistRange.IsChecked ? float.Parse(nudHistUP.Text) : 255);
            HistoBox.Refresh();
            WinHost.Child = HistoBox;
            canvasRB.Children.Add(WinHost);
        }
示例#3
0
        private void AddHistogram(Image <Bgr, byte> image, Color color, HistogramBox histogramBox)
        {
            using (DenseHistogram histogram = new DenseHistogram(256, new RangeF(0f, 255f)))
            {
                Mat mat = new Mat();

                if (color == Color.Black)
                {
                    histogram.Calculate(new Image <Gray, byte>[] { image.Convert <Gray, byte>() }, false, null);
                }
                else if (color == Color.Blue)
                {
                    histogram.Calculate(new Image <Gray, byte>[] { image[0] }, false, null);
                }
                else if (color == Color.Red)
                {
                    histogram.Calculate(new Image <Gray, byte>[] { image[1] }, false, null);
                }
                else if (color == Color.Green)
                {
                    histogram.Calculate(new Image <Gray, byte>[] { image[2] }, false, null);
                }
                else
                {
                    return;
                }

                histogram.CopyTo(mat);

                histogramBox.ClearHistogram();
                histogramBox.AddHistogram(color.ToString(), color, mat, 256, new float[] { 0f, 255f });
                histogramBox.Refresh();
            }
        }
 void DisplayResultHisto(ImgPResult data)
 {
     HistoBox.ClearHistogram();
     HistoBox.Name = "AreaSize";
     AddHist2Box(HistoBox, ref HistogramList, HistoFromResult(data),
                 ( bool )ckbSetHistRange.IsChecked ? float.Parse(nudHistDW.Text) : 0,
                 ( bool )ckbSetHistRange.IsChecked ? float.Parse(nudHistUP.Text) : 255);
     HistoBox.Refresh();
     WinHost.Child = HistoBox;
     //canvasHist.Children.Clear();
     //canvasHist.Children.Add( WinHost );
 }
示例#5
0
        void DisplayResultHisto(ImgPResult data)
        {
            HistoBox.ClearHistogram();
            var passfun = curry(HistoFromResult(data)); // Passing Form

            AddHist2Box(HistoBox, HistogramList, passfun,
                        ( bool )ckbSetHistRange.IsChecked ? float.Parse(nudHistDW.Text) : 0,
                        ( bool )ckbSetHistRange.IsChecked ? float.Parse(nudHistUP.Text) : 255);
            HistoBox.Refresh();
            WinHost.Child = HistoBox;
            canvasRB.Children.Clear();
            canvasRB.Children.Add(WinHost);
        }
示例#6
0
 void DisplayResultHisto(ImgPResult data)
 {
     try
     {
         HistoBox.ClearHistogram();
         var passfun = HistoFromResult(data); // Passing Form
         AddHist2Box(HistoBox, HistogramList, passfun);
         HistoBox.Refresh();
         WinHost.Child = HistoBox;
         canvasRB.Children.Clear();
         canvasRB.Children.Add(WinHost);
     }
     catch (Exception)
     {
     }
 }
        private void BtnFotoSec_Click_1(object sender, EventArgs e)
        {
            string            FotoGetir  = DosyaAdiGetir();
            Image <Bgr, byte> renkliFoto = new Image <Bgr, byte>(FotoGetir);

            FotoImageBox.Image = renkliFoto;
            //gri image
            Image <Gray, byte> griFoto = GriGetir(renkliFoto);

            GriImageBox.Image = griFoto;
            //binary image
            Image <Gray, byte> binaryFoto = BinaryGetir(griFoto);

            BinaryImageBox.Image = binaryFoto;

            //histogram
            Mat m = HistogramGetir(griFoto);

            HistogramBox.ClearHistogram();
            HistogramBox.AddHistogram("Gri Histogram", Color.Gray, m, 256, new float[] { 0.0f, 256.0f });
            HistogramBox.Refresh();
        }