当前位置: 首页>>代码示例>>C#>>正文


C# MagickImage.Threshold方法代码示例

本文整理汇总了C#中ImageMagick.MagickImage.Threshold方法的典型用法代码示例。如果您正苦于以下问题:C# MagickImage.Threshold方法的具体用法?C# MagickImage.Threshold怎么用?C# MagickImage.Threshold使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ImageMagick.MagickImage的用法示例。


在下文中一共展示了MagickImage.Threshold方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ExecuteThreshold

 private void ExecuteThreshold(XmlElement element, MagickImage image)
 {
   Percentage percentage_ = Variables.GetValue<Percentage>(element, "percentage");
   image.Threshold(percentage_);
 }
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:5,代码来源:MagickImage.cs

示例2: Test_Compare

    public void Test_Compare()
    {
      MagickImage first = new MagickImage(Files.SnakewarePNG);
      MagickImage second = first.Clone();

      MagickErrorInfo same = first.Compare(second);
      Assert.IsNotNull(same);
      Assert.AreEqual(0, same.MeanErrorPerPixel);

      double distortion = first.Compare(second, ErrorMetric.Absolute);
      Assert.AreEqual(0, distortion);

      first.Threshold(new Percentage(50));
      MagickErrorInfo different = first.Compare(second);
      Assert.IsNotNull(different);
      Assert.AreNotEqual(0, different.MeanErrorPerPixel);

      distortion = first.Compare(second, ErrorMetric.Absolute);
      Assert.AreNotEqual(0, distortion);

      MagickImage difference = new MagickImage();
      distortion = first.Compare(second, ErrorMetric.RootMeanSquared, difference);
      Assert.AreNotEqual(0, distortion);
      Assert.AreNotEqual(first, difference);
      Assert.AreNotEqual(second, difference);
    }
开发者ID:marinehero,项目名称:Magick.NET,代码行数:26,代码来源:MagickImageTests.cs

示例3: Test_BitDepth

    public void Test_BitDepth()
    {
      using (MagickImage image = new MagickImage(Files.RoseSparkleGIF))
      {
        Assert.AreEqual(8, image.BitDepth());

        image.Threshold((Percentage)50);
        Assert.AreEqual(1, image.BitDepth());
      }
    }
开发者ID:marinehero,项目名称:Magick.NET,代码行数:10,代码来源:MagickImageTests.cs

示例4: Test_Threshold

 public void Test_Threshold()
 {
   using (MagickImage image = new MagickImage(Files.ImageMagickJPG))
   {
     using (MemoryStream memStream = new MemoryStream())
     {
       image.Threshold(new Percentage(80));
       image.CompressionMethod = CompressionMethod.Group4;
       image.Format = MagickFormat.Pdf;
       image.Write(memStream);
     }
   }
 }
开发者ID:marinehero,项目名称:Magick.NET,代码行数:13,代码来源:MagickImageTests.cs

示例5: Test_Compare

    public void Test_Compare()
    {
      MagickImage first = new MagickImage(Files.ImageMagickJPG);

      ExceptionAssert.Throws<ArgumentNullException>(delegate ()
      {
        first.Compare(null);
      });

      MagickImage second = first.Clone();

      MagickErrorInfo same = first.Compare(second);
      Assert.IsNotNull(same);
      Assert.AreEqual(0, same.MeanErrorPerPixel);

      double distortion = first.Compare(second, ErrorMetric.Absolute);
      Assert.AreEqual(0, distortion);

      first.Threshold(new Percentage(50));
      MagickErrorInfo different = first.Compare(second);
      Assert.IsNotNull(different);
      Assert.AreNotEqual(0, different.MeanErrorPerPixel);

      distortion = first.Compare(second, ErrorMetric.Absolute);
      Assert.AreNotEqual(0, distortion);

      MagickImage difference = new MagickImage();
      distortion = first.Compare(second, ErrorMetric.RootMeanSquared, difference);
      Assert.AreNotEqual(0, distortion);
      Assert.AreNotEqual(first, difference);
      Assert.AreNotEqual(second, difference);

      second.Dispose();

      first.Opaque(MagickColors.Black, MagickColors.Green);
      first.Opaque(MagickColors.White, MagickColors.Green);

      second = first.Clone();
      second.FloodFill(MagickColors.Gray, 0, 0);

      distortion = first.Compare(second, ErrorMetric.Absolute, Channels.Green);
      Assert.AreEqual(0, distortion);

      distortion = first.Compare(second, ErrorMetric.Absolute, Channels.Red);
      Assert.AreNotEqual(0, distortion);
    }
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:46,代码来源:MagickImageTests.cs

示例6: Test_CannyEdge_HoughLine

    public void Test_CannyEdge_HoughLine()
    {
      using (MagickImage image = new MagickImage(Files.ConnectedComponentsPNG))
      {
        image.Threshold(new Percentage(50));

        ColorAssert.AreEqual(MagickColors.Black, image, 150, 365);
        image.Negate();
        ColorAssert.AreEqual(MagickColors.White, image, 150, 365);

        image.CannyEdge();
        ColorAssert.AreEqual(MagickColors.Black, image, 150, 365);

        image.Crop(260, 180, 215, 200);

        image.Settings.FillColor = MagickColors.Red;
        image.Settings.StrokeColor = MagickColors.Red;

        image.HoughLine();
        ColorAssert.AreEqual(MagickColors.Red, image, 105, 25);
      }
    }
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:22,代码来源:MagickImageTests.cs


注:本文中的ImageMagick.MagickImage.Threshold方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。