Esempio n. 1
0
            public void ShouldNotSetTheAttributesWhenTheyAreNotSpecified()
            {
                using (var image = new MagickImage())
                {
                    var settings = new ConnectedComponentsSettings();

                    settings.SetImageArtifacts(image);

                    Assert.Empty(image.ArtifactNames);
                }
            }
Esempio n. 2
0
            public void ShouldSetTheMinumunAndMaximumAreaThreshold()
            {
                using (var image = new MagickImage())
                {
                    var settings = new ConnectedComponentsSettings()
                    {
                        AreaThreshold = new Threshold(1.2, 3.4),
                    };

                    settings.SetImageArtifacts(image);

                    Assert.AreEqual("1.2-3.4", image.GetArtifact("connected-components:area-threshold"));
                }
            }
Esempio n. 3
0
            public void ShouldSetTheAngleThreshold()
            {
                using (var image = new MagickImage())
                {
                    var settings = new ConnectedComponentsSettings()
                    {
                        AngleThreshold = new Threshold(1.5),
                    };

                    settings.SetImageArtifacts(image);

                    Assert.AreEqual("1.5", image.GetArtifact("connected-components:angle-threshold"));
                }
            }
Esempio n. 4
0
            public void ShouldSetMeanColor()
            {
                using (var image = new MagickImage())
                {
                    var settings = new ConnectedComponentsSettings()
                    {
                        MeanColor = true,
                    };

                    settings.SetImageArtifacts(image);

                    Assert.AreEqual("true", image.GetArtifact("connected-components:mean-color"));
                }
            }
Esempio n. 5
0
            public void ShouldSetTheMinumunAndMaximumPerimeterThreshold()
            {
                using (var image = new MagickImage())
                {
                    var settings = new ConnectedComponentsSettings
                    {
                        PerimeterThreshold = new Threshold(1.2, 3.4),
                    };

                    settings.SetImageArtifacts(image);

                    Assert.Single(image.ArtifactNames);
                    Assert.Equal("1.2-3.4", image.GetArtifact("connected-components:perimeter-threshold"));
                }
            }
Esempio n. 6
0
            public void ShouldSetTheMinorAxisThreshold()
            {
                using (var image = new MagickImage())
                {
                    var settings = new ConnectedComponentsSettings
                    {
                        MinorAxisThreshold = new Threshold(1.5),
                    };

                    settings.SetImageArtifacts(image);

                    Assert.Single(image.ArtifactNames);
                    Assert.Equal("1.5", image.GetArtifact("connected-components:minor-axis-threshold"));
                }
            }
Esempio n. 7
0
            public void ShouldSetThePerimeterThreshold()
            {
                using (var image = new MagickImage())
                {
                    var settings = new ConnectedComponentsSettings()
                    {
                        PerimeterThreshold = new Threshold(1.5),
                    };

                    settings.SetImageArtifacts(image);

                    EnumerableAssert.IsSingle(image.ArtifactNames);
                    Assert.AreEqual("1.5", image.GetArtifact("connected-components:perimeter-threshold"));
                }
            }
Esempio n. 8
0
            public void ShouldSetTheMinumunAndMaximumMinorAxisThreshold()
            {
                using (var image = new MagickImage())
                {
                    var settings = new ConnectedComponentsSettings()
                    {
                        MinorAxisThreshold = new Threshold(1.2, 3.4),
                    };

                    settings.SetImageArtifacts(image);

                    EnumerableAssert.IsSingle(image.ArtifactNames);
                    Assert.AreEqual("1.2-3.4", image.GetArtifact("connected-components:minor-axis-threshold"));
                }
            }
            public void ShouldRemoveTheEccentricityThreshold()
            {
                using (var image = new MagickImage())
                {
                    var settings = new ConnectedComponentsSettings()
                    {
                        EccentricityThreshold = new Threshold(1.5),
                    };

                    settings.SetImageArtifacts(image);
                    settings.RemoveImageArtifacts(image);

                    Assert.IsNull(image.GetArtifact("connected-components:eccentricity-threshold"));
                }
            }
            public void ShouldRemoveMeanColor()
            {
                using (var image = new MagickImage())
                {
                    var settings = new ConnectedComponentsSettings()
                    {
                        MeanColor = true,
                    };

                    settings.SetImageArtifacts(image);
                    settings.RemoveImageArtifacts(image);

                    Assert.IsNull(image.GetArtifact("connected-components:mean-color"));
                }
            }
            public void ShouldRemoveTheEccentricityThreshold()
            {
                using (var image = new MagickImage())
                {
                    var settings = new ConnectedComponentsSettings
                    {
                        EccentricityThreshold = new Threshold(1.5),
                    };

                    settings.SetImageArtifacts(image);
                    settings.RemoveImageArtifacts(image);

                    Assert.Empty(image.ArtifactNames);
                }
            }
            public void ShouldRemoveMeanColor()
            {
                using (var image = new MagickImage())
                {
                    var settings = new ConnectedComponentsSettings
                    {
                        MeanColor = true,
                    };

                    settings.SetImageArtifacts(image);
                    settings.RemoveImageArtifacts(image);

                    Assert.Empty(image.ArtifactNames);
                }
            }
            public void ShouldRemoveTheDiameterThreshold()
            {
                using (var image = new MagickImage())
                {
                    var settings = new ConnectedComponentsSettings()
                    {
                        DiameterThreshold = new Threshold(1.5),
                    };

                    settings.SetImageArtifacts(image);
                    settings.RemoveImageArtifacts(image);

                    EnumerableAssert.IsEmpty(image.ArtifactNames);
                }
            }
Esempio n. 14
0
            public void ShouldNotSetTheAttributesWhenTheyAreNotSpecified()
            {
                using (var image = new MagickImage())
                {
                    var settings = new ConnectedComponentsSettings();

                    settings.SetImageArtifacts(image);

                    Assert.IsNull(image.GetArtifact("connected-components:angle-threshold"));
                    Assert.IsNull(image.GetArtifact("connected-components:area-threshold"));
                    Assert.IsNull(image.GetArtifact("connected-components:circularity-threshold"));
                    Assert.IsNull(image.GetArtifact("connected-components:diameter-threshold"));
                    Assert.IsNull(image.GetArtifact("connected-components:eccentricity-threshold"));
                    Assert.IsNull(image.GetArtifact("connected-components:major-axis-threshold"));
                    Assert.IsNull(image.GetArtifact("connected-components:mean-color"));
                    Assert.IsNull(image.GetArtifact("connected-components:minor-axis-threshold"));
                    Assert.IsNull(image.GetArtifact("connected-components:perimeter-threshold"));
                }
            }