]> granicus.if.org Git - imagemagick/commitdiff
Added autoThreshold to Magick++.
authorDirk Lemstra <dirk@git.imagemagick.org>
Thu, 20 Jul 2017 21:43:20 +0000 (23:43 +0200)
committerDirk Lemstra <dirk@git.imagemagick.org>
Thu, 20 Jul 2017 21:43:20 +0000 (23:43 +0200)
Magick++/lib/Image.cpp
Magick++/lib/Magick++/Image.h
Magick++/lib/Magick++/Include.h

index 8e18fd12f63cdeab7dbc518e90824863b10b4d80..8814b96d0046c6d1c0a4467dc37b57e5564f6723 100644 (file)
@@ -2054,6 +2054,14 @@ void Magick::Image::autoOrient(void)
   ThrowImageException;
 }
 
+void Magick::Image::autoThreshold(const AutoThresholdMethod method_)
+{
+  modifyImage();
+  GetPPException;
+  AutoThresholdImage(image(),method_, exceptionInfo);
+  ThrowImageException;
+}
+
 void Magick::Image::blackThreshold(const std::string &threshold_)
 {
   modifyImage();
index efa1b98120f64d373f1366b58cd328633fd038ce..4d6ccd3623cdca99fe724da29f48c7d022b3e470 100644 (file)
@@ -1,7 +1,7 @@
 // This may look like C code, but it is really -*- C++ -*-
 //
 // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002, 2003
-// Copyright Dirk Lemstra 2013-2016
+// Copyright Dirk Lemstra 2013-2017
 //
 // Definition of Image, the representation of a single image in Magick++
 //
@@ -641,6 +641,11 @@ namespace Magick
     // Adjusts an image so that its orientation is suitable for viewing.
     void autoOrient(void);
 
+    // Automatically selects a threshold and replaces each pixel in the image
+    // with a black pixel if the image intentsity is less than the selected
+    // threshold otherwise white.
+    void autoThreshold(const AutoThresholdMethod method_);
+
     // Forces all pixels below the threshold into black while leaving all
     // pixels at or above the threshold unchanged.
     void blackThreshold(const std::string &threshold_);
index fb18091b27896de2f10bf6711afe8e50340807af..bbb1d62f8df6eb843b28375cb66362773a85d2b4 100644 (file)
@@ -336,6 +336,13 @@ namespace Magick
   using MagickCore::ShapeAlphaChannel;
   using MagickCore::TransparentAlphaChannel;
 
+  // Auto threshold methods
+  using MagickCore::AutoThresholdMethod;
+  using MagickCore::UndefinedThresholdMethod;
+  using MagickCore::KapurThresholdMethod;
+  using MagickCore::OTSUThresholdMethod;
+  using MagickCore::TriangleThresholdMethod;
+
   // Channel types
   using MagickCore::ChannelType;
   using MagickCore::UndefinedChannel;
@@ -1144,6 +1151,7 @@ namespace Magick
   using MagickCore::AutoGammaImage;
   using MagickCore::AutoLevelImage;
   using MagickCore::AutoOrientImage;
+  using MagickCore::AutoThresholdImage;
   using MagickCore::Base64Decode;
   using MagickCore::Base64Encode;
   using MagickCore::BilevelImage;