temp = new Image<Bgr, byte>("F:\\project\\brige1.png"); Image<Gray, byte> img3 = temp.Convert<Gray, byte>().ThresholdBinary(new Gray(50), new Gray(255)).Dilate(1).Erode(1); Emgu.CV.Util.VectorOfVectorOfPoint contours = new Emgu.CV.Util.VectorOfVectorOfPoint(); Mat m = new Mat(); CvInvoke.FindContours(img3, contours, m, Emgu.CV.CvEnum.RetrType.External, Emgu.CV.CvEnum.ChainApproxMethod.ChainApproxSimple); Dictionary<int, double> dict = new Dictionary<int, double>(); if (contours.Size > 0) { for (int i = 0; i < contours.Size; i++) { Rectangle rect = CvInvoke.BoundingRectangle(contours[i]); double aera = CvInvoke.ContourArea(contours[i]); int h = rect.Height; MessageBox.Show("The heith is = " + h.ToString()); CvInvoke.Rectangle(temp, rect, new MCvScalar(0, 255, 0), 3); pictureBox5.Image = temp.Bitmap; }
358
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)