private void Form1_Load(object sender, EventArgs e) { GetFiles(); Form m, m2; Emgu.CV.UI.HistogramBox hbox; Emgu.CV.UI.HistogramBox hbox2; m = new Form(); hbox = new Emgu.CV.UI.HistogramBox(); m.Controls.Add(hbox); hbox.Dock = DockStyle.Fill; hbox.ZedGraphControl.Dock = DockStyle.Fill; m.Show(); m.Visible = false; m.FormClosing += M_FormClosing; m2 = new Form(); hbox2 = new Emgu.CV.UI.HistogramBox(); m2.Controls.Add(hbox2); hbox2.Dock = DockStyle.Fill; hbox2.ZedGraphControl.Dock = DockStyle.Fill; m2.Show(); m2.Visible = false; m2.FormClosing += M_FormClosing; string extToAdd = ".Histo.jpg"; string savePath = imagen.path + "\\" + imagen.curentfilename.Replace(".jpg", extToAdd); histoBtnRaw.Click += delegate { Image <Rgba, byte> aux = imagen.UIOne; SetHistogram(ref aux, savePath, ref hbox); m.Visible = true; }; extToAdd = ".HistoCorrected.jpg"; savePath = imagen.path + "\\" + imagen.curentfilename.Replace(".jpg", extToAdd); this.histoBtnCorr.Click += delegate { Image <Rgba, byte> aux = imagen.imgUtil.rotated; SetHistogram(ref aux, savePath, ref hbox2); m2.Visible = true; }; }
protected override void inicializarVariaveis() { base.inicializarVariaveis(); mDetector = new Emgu.CV.VideoSurveillance.BackgroundSubtractorMOG2(); mBlobDetector = new CvBlobDetector(); Size vTamanhoDasImagens = mImagemColorida.Size; mImagemCinzaSemPlanoDeFundo = new Mat(); mImagemDoPlanoDeFundo = new Mat(vTamanhoDasImagens.Width, vTamanhoDasImagens.Height, DepthType.Cv32F, 3); mImagemSemPlanoDeFundo = null;// = cvCreateImage(gTamanhoDaImagem, IPL_DEPTH_32F, 3);; mCopiaImagemPlanoDeFundo = null; mImagemBinariaSemPlanoDeFundo = new Mat(); vHist = new Emgu.CV.UI.HistogramBox(); vHist.Show(); vHist.Visible = true; mPrimeiraExecucao = true; dicionarioMonitores = new Dictionary <int, MonitorDePessoa>(); dicionarioBlobs = new Dictionary <int, MCvBlob>(); }
private static void SetHistogram(ref Image <Rgba, byte> aux, string savePath, ref Emgu.CV.UI.HistogramBox h) { h.ClearHistogram(); h.GenerateHistograms(aux, 256); h.ZedGraphControl.AxisChange(); h.ZedGraphControl.GetImage() .Save(savePath); }
protected override void inicializarVariaveis() { base.inicializarVariaveis(); mDetector = new Emgu.CV.VideoSurveillance.BackgroundSubtractorMOG2(); mBlobDetector = new CvBlobDetector(); Size vTamanhoDasImagens = mImagemColorida.Size; mImagemCinzaSemPlanoDeFundo = new Mat(); mImagemDoPlanoDeFundo = new Mat(vTamanhoDasImagens.Width, vTamanhoDasImagens.Height, DepthType.Cv32F, 3); mImagemSemPlanoDeFundo = null;// = cvCreateImage(gTamanhoDaImagem, IPL_DEPTH_32F, 3);; mCopiaImagemPlanoDeFundo = null; mImagemBinariaSemPlanoDeFundo = new Mat(); vHist = new Emgu.CV.UI.HistogramBox(); vHist.Show(); vHist.Visible = true; mPrimeiraExecucao = true; dicionarioMonitores = new Dictionary<int, MonitorDePessoa>(); dicionarioBlobs = new Dictionary<int, MCvBlob>(); }