]> granicus.if.org Git - imagemagick/commitdiff
Add WaveletDenoise method to PerlMagick
authorCristy <urban-warrior@imagemagick.org>
Sun, 21 Feb 2016 15:54:16 +0000 (10:54 -0500)
committerCristy <urban-warrior@imagemagick.org>
Sun, 21 Feb 2016 15:54:16 +0000 (10:54 -0500)
MagickCore/fx.c
MagickWand/convert.c
MagickWand/mogrify.c
PerlMagick/Magick.xs
PerlMagick/demo/demo.pl
PerlMagick/quantum/quantum.xs.in
utilities/convert.1.in
utilities/mogrify.1.in

index e07b8dded0c9d7b1d7a30fed2f8834813feee193..9131c70abb405dda0cc4557f6dd3e90c33fae400 100644 (file)
@@ -5772,8 +5772,8 @@ static inline void hat_transform(double *temp,double *base,ssize_t st,
     temp[i]=2*base[st*i]+base[st*(i-sc)]+base[st*(2*size-2-(i+sc))];
 }
 
-MagickExport Image *WaveletDenoiseImage(const Image *image, const double threshold,
-  ExceptionInfo *exception)
+MagickExport Image *WaveletDenoiseImage(const Image *image,
+  const double threshold,ExceptionInfo *exception)
 {
   CacheView
     *image_view,
@@ -5990,4 +5990,4 @@ MagickExport Image *WaveletDenoiseImage(const Image *image, const double thresho
   interImage_info=RelinquishVirtualMemory(interImage_info);
 
   return(noise_image);
-}
\ No newline at end of file
+}
index d8ba405a0c0cafdaa822249e27d525f1db7da7f5..3fc969507a93b1680cbfb854dda0713592411a74 100644 (file)
@@ -319,7 +319,7 @@ static MagickBooleanType ConvertUsage(void)
       "-vignette geometry   soften the edges of the image in vignette style",
       "-wave geometry       alter an image along a sine wave",
       "-wavelet-denoise threshold",
-      "                     removes noise from the image using a wavelet transform.",
+      "                     removes noise from the image using a wavelet transform",
       "-white-threshold value",
       "                     force all pixels above the threshold into white",
       (char *) NULL
index ff0768680a15eea44021a54f93e0b6ce5cea1c62..4f5c0580c64da4220a19a989d1faa8ac40784573 100644 (file)
@@ -3609,7 +3609,7 @@ static MagickBooleanType MogrifyUsage(void)
       "-vignette geometry   soften the edges of the image in vignette style",
       "-wave geometry       alter an image along a sine wave",
       "-wavelet-denoise threshold",
-      "                     removes noise from the image using a wavelet transform.",
+      "                     removes noise from the image using a wavelet transform",
       "-white-threshold value",
       "                     force all pixels above the threshold into white",
       (char *) NULL
index 22524926694d7c533970abf76d544e18ec68f8d5..30ea5f72d9800b245611d0e13a0be8e0e9a57780 100644 (file)
@@ -560,6 +560,8 @@ static struct
       {"gravity", MagickGravityOptions}, {"offset", StringReference}, 
       {"dx", IntegerReference}, {"dy", IntegerReference} } },
     { "Color", { {"color", StringReference} } },
+    { "WaveletDenoise", { {"threshold", StringReference},
+      {"channel", MagickChannelOptions} } },
   };
 
 static SplayTreeInfo
@@ -7582,6 +7584,8 @@ Mogrify(ref,...)
     CopyImagePixels    = 286
     Color              = 287
     ColorImage         = 288
+    WaveletDenoise     = 289
+    WaveletDenoiseImage= 290
     MogrifyRegion      = 666
   PPCODE:
   {
@@ -11321,6 +11325,19 @@ Mogrify(ref,...)
           (void) SetImageColor(image,&color,exception);
           break;
         }
+        case 145:  /* WaveletDenoise */
+        {
+          if (attribute_flag[0] == 0)
+            argument_list[0].string_reference="50%";
+          if (attribute_flag[2] != 0)
+            channel=(ChannelType) argument_list[2].integer_reference;
+          channel_mask=SetImageChannelMask(image,channel);
+          image=WaveletDenoiseImage(image,argument_list[0].string_reference,
+            exception);
+          if (image != (Image *) NULL)
+            (void) SetImageChannelMask(image,channel_mask);
+          break;
+        }
       }
       if (next != (Image *) NULL)
         (void) CatchImageException(next);
index 6da27b1789e71f6186137c9eb827e871d6b36a3b..fe6a96f6511299ff1dd564dc58da7adda1965cf6 100644 (file)
@@ -480,6 +480,13 @@ $example=$model->Clone();
 $example->Label('Wave');
 $example->Wave('25x150');
 push(@$images,$example);
+
+print "WaveletDenoise...\n";
+$example=$model->Clone();
+$example->Label('WaveletDenoise');
+$example->WaveletDenoise();
+push(@$images,$example);
+
 #
 # Create image montage.
 #
index b7b866d64cec5e627beabd8c595ad083e64774d4..f9a65af4870d718796b35a268ec52e022a615333 100644 (file)
@@ -560,6 +560,8 @@ static struct
       {"gravity", MagickGravityOptions}, {"offset", StringReference}, 
       {"dx", IntegerReference}, {"dy", IntegerReference} } },
     { "Color", { {"color", StringReference} } },
+    { "WaveletDenoise", { {"threshold", StringReference},
+      {"channel", MagickChannelOptions} } },
   };
 
 static SplayTreeInfo
@@ -7582,6 +7584,8 @@ Mogrify(ref,...)
     CopyImagePixels    = 286
     Color              = 287
     ColorImage         = 288
+    WaveletDenoise     = 289
+    WaveletDenoiseImage= 290
     MogrifyRegion      = 666
   PPCODE:
   {
@@ -11321,6 +11325,19 @@ Mogrify(ref,...)
           (void) SetImageColor(image,&color,exception);
           break;
         }
+        case 145:  /* WaveletDenoise */
+        {
+          if (attribute_flag[0] == 0)
+            argument_list[0].string_reference="50%";
+          if (attribute_flag[2] != 0)
+            channel=(ChannelType) argument_list[2].integer_reference;
+          channel_mask=SetImageChannelMask(image,channel);
+          image=WaveletDenoiseImage(image,argument_list[0].string_reference,
+            exception);
+          if (image != (Image *) NULL)
+            (void) SetImageChannelMask(image,channel_mask);
+          break;
+        }
       }
       if (next != (Image *) NULL)
         (void) CatchImageException(next);
index 0d13d847e30566a2ede0ce58698e2266740e287d..974c2809e26ab479ab847f75a93656e4aad8146e 100644 (file)
@@ -262,6 +262,8 @@ Image Operators:
   \-unsharp geometry    sharpen the image
   \-vignette geometry   soften the edges of the image in vignette style
   \-wave geometry       alter an image along a sine wave
+  \-wavelet-denoise threshold
+                        removes noise from the image using a wavelet transform
   \-white-threshold value
                        force all pixels above the threshold into white
 
index dd0ae884dccd7630938757481a0d94ff77d393ff..62ecb128cd68a0ad55d4224cb7642d21d14db79e 100644 (file)
@@ -261,6 +261,8 @@ Image Operators:
   \-unsharp geometry    sharpen the image
   \-vignette geometry   soften the edges of the image in vignette style
   \-wave geometry       alter an image along a sine wave
+  \-wavelet-denoise threshold
+                        removes noise from the image using a wavelet transform
   \-white-threshold value
                        force all pixels above the threshold into white