Esempio n. 1
0
        public void DrawEdges(
            string sourceFileName,
            GradientOperator gradientOperator, int gradientThreshold,
            int anchorScanInterval, int anchorThreshold)
        {
            // Arrange
            var source      = LoadImage(sourceFileName);
            var rows        = source.Size.Height;
            var columns     = source.Size.Width;
            var edgeDrawing = new EdgeDrawing(rows, columns);
            var edgesMap    = new Mat(rows, columns, Depth.U8, 1);

            edgesMap.Set(Scalar.All(0));

            // Act
            edgeDrawing.DrawEdges(source, edgesMap, gradientOperator, gradientThreshold, anchorScanInterval, anchorThreshold);

            // Assert
            var resultFileName = Path.Combine("Output", "DrawEdges", $"{Path.GetFileNameWithoutExtension(sourceFileName)}_{gradientOperator}_{gradientThreshold}_{anchorScanInterval}_{anchorThreshold}_EdgesMap.png");

            SaveImage(edgesMap, resultFileName);
        }
Esempio n. 2
0
        public void DrawEdge(
            int row, int column,
            string gradientFileName, string directionFileName, string expectedFileName, string differencesFileName)
        {
            // Arrange
            var gradientMap  = LoadImage(gradientFileName);
            var directionMap = LoadImage(directionFileName);
            var expectedMap  = LoadImage(expectedFileName);
            var rows         = gradientMap.Size.Height;
            var columns      = gradientMap.Size.Width;
            var edgesMap     = new Mat(rows, columns, Depth.U8, 1);

            edgesMap.Set(Scalar.All(0));
            var differencesMap = new Mat(rows, columns, Depth.U8, 1);

            // Act
            EdgeDrawing.DrawEdge(row, column, edgesMap, gradientMap, directionMap, rows, columns);

            // Assert
            CV.Cmp(edgesMap, expectedMap, differencesMap, ComparisonOperation.NotEqual);
            SaveImage(differencesMap, differencesFileName);
        }