]> granicus.if.org Git - imagemagick/commitdiff
Decorate GetLocalTime() to avoid namespace collision
authorCristy <mikayla-grace@urban-warrior.org>
Wed, 17 Apr 2019 21:48:08 +0000 (17:48 -0400)
committerCristy <mikayla-grace@urban-warrior.org>
Wed, 17 Apr 2019 21:48:08 +0000 (17:48 -0400)
ChangeLog
MagickCore/threshold.c
MagickCore/timer-private.h
MagickCore/timer.c
MagickWand/magick-image.c
MagickWand/magick-image.h
coders/cin.c
coders/mat.c
coders/pdf.c

index cc8e01acb932d6be2272f372ee6d39df8b0e3354..1c66fc41dcdd6ee71afaa40a9bb196bd0a1783c4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,12 @@
   * Honor SOURCE_DATE_EPOCH environment variable (reference
     https://github.com/ImageMagick/ImageMagick/pull/1496/).
   * Standardize on UTC time for any image format timestamp.
+  * Add MagickAutoThresholdImage(), MagickCannyEdgeImage(),
+    MagickComplexImages(), MagickConnectedComponentsImage(),
+    MagickHoughLineImage(), MagickKuwaharaImage(), MagickLevelizeImageColors(),
+    MagickLevelImageColors(), MagickMeanShiftImage(), MagickPolynomialImage(),
+    MagickRangeThresholdImage(), MagickSetSeed(), MagickWaveletDenoiseImage()
+    to MagickWand API.
 
 2019-04-07  7.0.8-39 Cristy  <quetzlzacatenango@image...>
   * Release ImageMagick version 7.0.8-39, GIT revision 15489:6120f8bc1:20190406
index 00b875ad151523ec3b33b4b2d05e110d691490b4..4323cf0ab56db611167fd41d75f708a79693dcb4 100644 (file)
@@ -366,9 +366,8 @@ MagickExport Image *AdaptiveThresholdImage(const Image *image,
 %                                                                             %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
-%  AutoThresholdImage() 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.
+%  AutoThresholdImage()  automatically performs image thresholding
+%  dependent on which method you specify.
 %
 %  The format of the AutoThresholdImage method is:
 %
index 56b0fe88d82aa12777767e174dbb03b6b96e8183..b1e8fbd931aea9d616c6890dd543b61233dc4a43 100644 (file)
@@ -22,7 +22,7 @@
 extern "C" {
 #endif
 
-static inline void GetUTCTime(const time_t *timep,struct tm *result)
+static inline void GetMagickUTCtime(const time_t *timep,struct tm *result)
 {
 #if defined(MAGICKCORE_HAVE_GMTIME_R)
   (void) gmtime_r(timep,result);
@@ -38,7 +38,7 @@ static inline void GetUTCTime(const time_t *timep,struct tm *result)
 #endif
 }
 
-static inline void GetLocalTime(const time_t *timep,struct tm *result)
+static inline void GetMagickLocaltime(const time_t *timep,struct tm *result)
 {
 #if defined(MAGICKCORE_HAVE_GMTIME_R)
   (void) localtime_r(timep,result);
index fe5ca2729d0a880d6c9a0dc8cb1939764eead722..8e795706160045c73f1261fbe27d3ff0d512f00a 100644 (file)
@@ -262,7 +262,7 @@ MagickExport ssize_t FormatMagickTime(const time_t time,const size_t length,
     gm_time;
 
   assert(timestamp != (char *) NULL);
-  GetUTCTime(&time,&gm_time);
+  GetMagickUTCtime(&time,&gm_time);
   count=FormatLocaleString(timestamp,length,
     "%04d-%02d-%02dT%02d:%02d:%02d%+03d:00",gm_time.tm_year+1900,
     gm_time.tm_mon+1,gm_time.tm_mday,gm_time.tm_hour,gm_time.tm_min,
index a8b9db28a73dd0e85dca8835cd13cfdf07bbe43e..fb73d9f2275daa111a478f9dc44bfae58961f5f8 100644 (file)
@@ -838,6 +838,45 @@ WandExport MagickBooleanType MagickAutoOrientImage(MagickWand *wand)
 %                                                                             %
 %                                                                             %
 %                                                                             %
+%   M a g i c k A u t o T h r e s h o l d I m a g e                           %
+%                                                                             %
+%                                                                             %
+%                                                                             %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%  MagickAutoThresholdImage() automatically performs image thresholding
+%  dependent on which method you specify.
+%
+%  The format of the AutoThresholdImage method is:
+%
+%      MagickBooleanType MagickAutoThresholdImage(MagickWand *wand,
+%        const AutoThresholdMethod method)
+%
+%  A description of each parameter follows:
+%
+%    o wand: the magick wand.
+%
+%    o method: choose from KapurThresholdMethod, OTSUThresholdMethod, or
+%      TriangleThresholdMethod.
+%
+*/
+WandExport MagickBooleanType MagickAutoThresholdImage(MagickWand *wand,
+  const AutoThresholdMethod method)
+{
+  assert(wand != (MagickWand *) NULL);
+  assert(wand->signature == MagickWandSignature);
+  if (wand->debug != MagickFalse)
+    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+  if (wand->images == (Image *) NULL)
+    ThrowWandException(WandError,"ContainsNoImages",wand->name);
+  return(AutoThresholdImage(wand->images,method,wand->exception));
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%                                                                             %
+%                                                                             %
+%                                                                             %
 %   M a g i c k B l a c k T h r e s h o l d I m a g e                         %
 %                                                                             %
 %                                                                             %
@@ -866,9 +905,6 @@ WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
   char
     thresholds[MagickPathExtent];
 
-  MagickBooleanType
-    status;
-
   assert(wand != (MagickWand *) NULL);
   assert(wand->signature == MagickWandSignature);
   if (wand->debug != MagickFalse)
@@ -879,8 +915,7 @@ WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
     PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
-  status=BlackThresholdImage(wand->images,thresholds,wand->exception);
-  return(status);
+  return(BlackThresholdImage(wand->images,thresholds,wand->exception));
 }
 \f
 /*
@@ -1091,6 +1126,60 @@ WandExport MagickBooleanType MagickBrightnessContrastImage(
 %                                                                             %
 %                                                                             %
 %                                                                             %
+%   M a g i c k C a n n y E d g e I m a g e                                   %
+%                                                                             %
+%                                                                             %
+%                                                                             %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%  MagickCannyEdgeImage() uses a multi-stage algorithm to detect a wide range of
+%  edges in images.
+%
+%  The format of the MagickCannyEdgeImage method is:
+%
+%      MagickBooleanType MagickCannyEdgeImage(MagickWand *wand,
+%        const double radius,const double sigma,const double lower_percent,
+%        const double upper_percent)
+%
+%  A description of each parameter follows:
+%
+%    o wand: the magick wand.
+%
+%    o radius: the radius of the gaussian smoothing filter.
+%
+%    o sigma: the sigma of the gaussian smoothing filter.
+%
+%    o lower_percent: percentage of edge pixels in the lower threshold.
+%
+%    o upper_percent: percentage of edge pixels in the upper threshold.
+%
+*/
+WandExport MagickBooleanType MagickCannyEdgeImage(MagickWand *wand,
+  const double radius,const double sigma,const double lower_percent,
+  const double upper_percent)
+{
+  Image
+    *edge_image;
+
+  assert(wand != (MagickWand *) NULL);
+  assert(wand->signature == MagickWandSignature);
+  if (wand->debug != MagickFalse)
+    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+  if (wand->images == (Image *) NULL)
+    ThrowWandException(WandError,"ContainsNoImages",wand->name);
+  edge_image=CannyEdgeImage(wand->images,radius,sigma,lower_percent,
+    upper_percent,wand->exception);
+  if (edge_image == (Image *) NULL)
+    return(MagickFalse);
+  ReplaceImageInList(&wand->images,edge_image);
+  return(MagickTrue);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%                                                                             %
+%                                                                             %
+%                                                                             %
 %   M a g i c k C h a n n e l F x I m a g e                                   %
 %                                                                             %
 %                                                                             %
@@ -1881,6 +1970,52 @@ WandExport MagickWand *MagickCompareImages(MagickWand *wand,
 %                                                                             %
 %                                                                             %
 %                                                                             %
+%   M a g i c k C o m p l e x I m a g e s                                     %
+%                                                                             %
+%                                                                             %
+%                                                                             %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%  MagickComplexImages() performs complex mathematics on an image sequence.
+%
+%  The format of the MagickComplexImages method is:
+%
+%      MagickWand *MagickComplexImages(MagickWand *wand,
+%        const ComplexOperator op)
+%
+%  A description of each parameter follows:
+%
+%    o wand: the magick wand.
+%
+%    o op: A complex operator. Choose from AddComplexOperator,
+%      ConjugateComplexOperator,DivideComplexOperator,
+%      MagnitudePhaseComplexOperator,MultiplyComplexOperator,
+%      RealImaginaryComplexOperator, SubtractComplexOperator.
+%
+*/
+WandExport MagickWand *MagickComplexImages(MagickWand *wand,
+  const ComplexOperator op)
+{
+  Image
+    *complex_image;
+
+  assert(wand != (MagickWand *) NULL);
+  assert(wand->signature == MagickWandSignature);
+  if (wand->debug != MagickFalse)
+    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
+  if (wand->images == (Image *) NULL)
+    return((MagickWand *) NULL);
+  complex_image=ComplexImages(wand->images,op,wand->exception);
+  if (complex_image == (Image *) NULL)
+    return((MagickWand *) NULL);
+  return(CloneMagickWandFromImages(wand,complex_image));
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%                                                                             %
+%                                                                             %
+%                                                                             %
 %   M a g i c k C o m p o s i t e I m a g e                                   %
 %                                                                             %
 %                                                                             %
index e10d5efcf58d6ab9d6d601e4adb2d4c5bdd4d57a..f00ca8ae20c9a3fa97db96613123160da82d56a8 100644 (file)
@@ -92,12 +92,15 @@ extern WandExport MagickBooleanType
   MagickAutoGammaImage(MagickWand *),
   MagickAutoLevelImage(MagickWand *),
   MagickAutoOrientImage(MagickWand *),
+  MagickAutoThresholdImage(MagickWand *,const AutoThresholdMethod),
   MagickBlackThresholdImage(MagickWand *,const PixelWand *),
   MagickBlueShiftImage(MagickWand *,const double),
   MagickBlurImage(MagickWand *,const double,const double),
   MagickBorderImage(MagickWand *,const PixelWand *,const size_t,const size_t,
     const CompositeOperator compose),
   MagickBrightnessContrastImage(MagickWand *,const double,const double),
+  MagickCannyEdgeImage(MagickWand *,const double,const double,const double,
+    const double),
   MagickCharcoalImage(MagickWand *,const double,const double),
   MagickChopImage(MagickWand *,const size_t,const size_t,const ssize_t,
     const ssize_t),
@@ -342,6 +345,7 @@ extern WandExport MagickWand
   *MagickCompareImages(MagickWand *,const MagickWand *,const MetricType,
     double *),
   *MagickCompareImagesLayers(MagickWand *,const LayerMethod),
+  *MagickComplexImages(MagickWand *,const ComplexOperator),
   *MagickDeconstructImages(MagickWand *),
   *MagickEvaluateImages(MagickWand *,const MagickEvaluateOperator),
   *MagickFxImage(MagickWand *,const char *),
index 202f8973043479004c187baed1a9a49a705a6e8c..cee28577da83df220b04a4ae10e17492f8536828 100644 (file)
@@ -992,7 +992,7 @@ static MagickBooleanType WriteCINImage(const ImageInfo *image_info,Image *image,
   offset+=WriteBlob(image,sizeof(cin.file.filename),(unsigned char *)
     cin.file.filename);
   seconds=GetMagickTime();
-  GetUTCTime(&seconds,&local_time);
+  GetMagickUTCtime(&seconds,&local_time);
   (void) memset(timestamp,0,sizeof(timestamp));
   (void) strftime(timestamp,MaxTextExtent,"%Y:%m:%d:%H:%M:%SUTC",&local_time);
   (void) memset(cin.file.create_date,0,sizeof(cin.file.create_date));
index 7c71fa643f8269ce7a3172a9c7c067bb1cc0addf..4a4f85d51489036e3e34e93459c23c763e07dcab 100644 (file)
@@ -1607,7 +1607,7 @@ static MagickBooleanType WriteMATImage(const ImageInfo *image_info,Image *image,
   image->depth=8;
 
   current_time=GetMagickTime();
-  GetUTCTime(&current_time,&local_time);
+  GetMagickUTCtime(&current_time,&local_time);
   (void) memset(MATLAB_HDR,' ',MagickMin(sizeof(MATLAB_HDR),124));
   FormatLocaleString(MATLAB_HDR,sizeof(MATLAB_HDR),
     "MATLAB 5.0 MAT-file, Platform: %s, Created on: %s %s %2d %2d:%2d:%2d %d",
index 5a5750f944f0f5a230a6950fd9dfaf59d5383a27..bb83cb7be4fbb8315c215cd357e6682ccd9ff615 100644 (file)
@@ -3009,7 +3009,7 @@ RestoreMSCWarning
     }
   (void) WriteBlobString(image,buffer);
   seconds=GetMagickTime();
-  GetUTCTime(&seconds,&local_time);
+  GetMagickUTCtime(&seconds,&local_time);
   (void) FormatLocaleString(date,MagickPathExtent,"D:%04d%02d%02d%02d%02d%02d",
     local_time.tm_year+1900,local_time.tm_mon+1,local_time.tm_mday,
     local_time.tm_hour,local_time.tm_min,local_time.tm_sec);