Exemple #1
0
        public void GetsTheSignatureOfAnObjectUsing8SamplePoints()
        {
            var inputImage = TestHelper.InterpretToBinaryImage(
                new[]
            {
                "     ###  ",
                "    #   # ",
                "   #     #",
                "   #     #",     // center: m = 3, n = 6
                "   #     #",
                "    #   # ",
                "     ###  "
            });

            int[] expectedSignature = { 3, 3, 3, 3, 3, 3, 3, 3 };

            var result = SignatureReader.GetSignature(inputImage, 8);

            result.NumberOfSamplingPoints.Should().Be(8);
            int[][] points = result.Get();
            points.Should().HaveCount(8);
            var radiusPoints = points.Select(x => x.Any() ? x[0] : 0).ToList();

            radiusPoints.Should().ContainInOrder(expectedSignature);
        }
        public static BinaryImage GetSignatureIn(BinaryImage binaryImage, int samplingRate = 180)
        {
            var signature = SignatureReader.GetSignature(binaryImage, samplingRate);

            return(SignaturePlotter.Plot(signature));
        }