Пример #1
0
        private HoughResult ProcessHoughTest(Image <Bgr, byte> image)
        {
            const int leftMargin = 0;
            const int upMargin   = 300;
            const int downMargin = 200;
            var       size       = image.Size;

            image.ROI = new Rectangle(leftMargin, upMargin, size.Width - leftMargin * 2,
                                      size.Height - upMargin - downMargin);

            HoughLines.PreprocessImage(image);

            var result = HoughLines.Compute(image);

            lineCache_.AddResult(result);
            result = lineCache_.GetCachedResult();

            result.MoveRoiResult(leftMargin, upMargin);
            image.ROI = Rectangle.Empty;
            var red = new Bgr(Color.Red);

            foreach (var line in result.SolidLines)
            {
                image.Draw(line, red, 3);
            }
            return(result);
        }