ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
MagickCore::Image* newImage =
- StatisticImage ( image(), MedianStatistic, radius_, &exceptionInfo );
+ StatisticImage ( image(), MedianStatistic, (size_t) radius_, (size_t)
+ radius_,&exceptionInfo );
replaceImage( newImage );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
MagickCore::Image* newImage =
- StatisticImage( image(), NonpeakStatistic, order_, &exceptionInfo );
+ StatisticImage( image(), NonpeakStatistic, (size_t) order_, (size_t) order_,
+ &exceptionInfo );
replaceImage( newImage );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
{ "Implode", { {"amount", RealReference},
{"interpolate", MagickInterpolateOptions} } },
{ "Magnify", },
- { "MedianFilter", { {"radius", RealReference}
- {"channel", MagickChannelOptions} } },
+ { "MedianFilter", { {"geometry", StringReference},
+ {"width", IntegerReference},{"height", IntegerReference},
+ {"channel", MagickChannelOptions} } },
{ "Minify", },
{ "OilPaint", { {"radius", RealReference} } },
- { "ReduceNoise", { {"radius", RealReference},
+ { "ReduceNoise", { {"geometry", StringReference},
+ {"width", IntegerReference},{"height", IntegerReference},
{"channel", MagickChannelOptions} } },
{ "Roll", { {"geometry", StringReference}, {"x", IntegerReference},
{"y", IntegerReference} } },
{"iterations", IntegerReference} } },
{ "ColorMatrix", { {"matrix", ArrayReference} } },
{ "Color", { {"color", StringReference} } },
- { "Mode", { {"radius", RealReference},
+ { "Mode", { {"geometry", StringReference},
+ {"width", IntegerReference},{"height", IntegerReference},
{"channel", MagickChannelOptions} } },
- { "Statistic", { {"radius", RealReference},
+ { "Statistic", { {"geometry", StringReference},
+ {"width", IntegerReference},{"height", IntegerReference},
{"channel", MagickChannelOptions}, {"type", MagickStatisticOptions} } }
};
}
case 18: /* MedianFilter */
{
- if (attribute_flag[0] == 0)
- argument_list[0].real_reference=0.0;
+ if (attribute_flag[0] != 0)
+ {
+ flags=ParseGeometry(argument_list[0].string_reference,
+ &geometry_info);
+ if ((flags & SigmaValue) == 0)
+ geometry_info.sigma=1.0;
+ }
if (attribute_flag[1] != 0)
- channel=(ChannelType) argument_list[1].integer_reference;
- image=StatisticImage(image,channel,MedianStatistics,
- argument_list[0].real_reference,exception);
+ geometry_info.rho=argument_list[1].real_reference;
+ if (attribute_flag[2] != 0)
+ geometry_info.sigma=argument_list[2].real_reference;
+ if (attribute_flag[3] != 0)
+ channel=(ChannelType) argument_list[3].integer_reference;
+ image=StatisticImage(image,channel,MedianStatistic,
+ (size_t) geometry_info.rho,(size_t) geometry_info.sigma,exception);
break;
}
case 19: /* Minify */
}
case 21: /* ReduceNoise */
{
- if (attribute_flag[0] == 0)
- argument_list[0].real_reference=0.0;
- image=ReduceNoiseImage(image,argument_list[0].real_reference,
- exception);
+ if (attribute_flag[0] != 0)
+ {
+ flags=ParseGeometry(argument_list[0].string_reference,
+ &geometry_info);
+ if ((flags & SigmaValue) == 0)
+ geometry_info.sigma=1.0;
+ }
if (attribute_flag[1] != 0)
- channel=(ChannelType) argument_list[1].integer_reference;
+ geometry_info.rho=argument_list[1].real_reference;
+ if (attribute_flag[2] != 0)
+ geometry_info.sigma=argument_list[2].real_reference;
+ if (attribute_flag[3] != 0)
+ channel=(ChannelType) argument_list[3].integer_reference;
image=StatisticImage(image,channel,NonpeakStatistic,
- argument_list[0].real_reference,exception);
+ (size_t) geometry_info.rho,(size_t) geometry_info.sigma,exception);
break;
}
case 22: /* Roll */
}
case 136: /* Mode */
{
- if (attribute_flag[0] == 0)
- argument_list[0].real_reference=0.0;
+ if (attribute_flag[0] != 0)
+ {
+ flags=ParseGeometry(argument_list[0].string_reference,
+ &geometry_info);
+ if ((flags & SigmaValue) == 0)
+ geometry_info.sigma=1.0;
+ }
if (attribute_flag[1] != 0)
- channel=(ChannelType) argument_list[1].integer_reference;
+ geometry_info.rho=argument_list[1].real_reference;
+ if (attribute_flag[2] != 0)
+ geometry_info.sigma=argument_list[2].real_reference;
+ if (attribute_flag[3] != 0)
+ channel=(ChannelType) argument_list[3].integer_reference;
image=StatisticImage(image,channel,ModeStatistic,
- argument_list[0].real_reference,exception);
+ (size_t) geometry_info.rho,(size_t) geometry_info.sigma,exception);
break;
}
case 137: /* Statistic */
statistic;
statistic=UndefinedStatistic;
- if (attribute_flag[0] == 0)
- argument_list[0].real_reference=0.0;
+ if (attribute_flag[0] != 0)
+ {
+ flags=ParseGeometry(argument_list[0].string_reference,
+ &geometry_info);
+ if ((flags & SigmaValue) == 0)
+ geometry_info.sigma=1.0;
+ }
if (attribute_flag[1] != 0)
- channel=(ChannelType) argument_list[1].integer_reference;
+ geometry_info.rho=argument_list[1].real_reference;
if (attribute_flag[2] != 0)
- statistic=(StatisticType) argument_list[2].integer_reference;
+ geometry_info.sigma=argument_list[2].real_reference;
+ if (attribute_flag[3] != 0)
+ channel=(ChannelType) argument_list[3].integer_reference;
+ if (attribute_flag[4] != 0)
+ statistic=(StatisticType) argument_list[4].integer_reference;
image=StatisicImageChannel(image,channel,statistic,
- argument_list[0].real_reference,exception);
+ (size_t) geometry_info.rho,(size_t) geometry_info.sigma,exception);
break;
}
}
}
}
median_image=StatisticImage(msl_info->image[n],MedianStatistic,
- geometry_info.rho,&msl_info->image[n]->exception);
+ (size_t) geometry_info.rho,(size_t) geometry_info.sigma,
+ &msl_info->image[n]->exception);
if (median_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
}
}
paint_image=StatisticImage(msl_info->image[n],NonpeakStatistic,
- geometry_info.rho,&msl_info->image[n]->exception);
+ (size_t) geometry_info.rho,(size_t) geometry_info.sigma,
+ &msl_info->image[n]->exception);
if (paint_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
Image
*median_image;
- median_image=StatisticImage(image,MedianStatistic,radius,exception);
+ median_image=StatisticImage(image,MedianStatistic,(size_t) radius,(size_t)
+ radius,exception);
return(median_image);
}
\f
Image
*mode_image;
- mode_image=StatisticImage(image,ModeStatistic,radius,exception);
+ mode_image=StatisticImage(image,ModeStatistic,(size_t) radius,(size_t) radius,
+ exception);
return(mode_image);
}
\f
Image
*reduce_image;
- reduce_image=StatisticImage(image,NonpeakStatistic,radius,exception);
+ reduce_image=StatisticImage(image,NonpeakStatistic,(size_t) radius,(size_t)
+ radius,exception);
return(reduce_image);
}
\f
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
flags=ParseGeometry(radius,&geometry_info);
- noise_image=StatisticImage(*image,NonpeakStatistic,geometry_info.rho,
- &(*image)->exception);
+ noise_image=StatisticImage(*image,NonpeakStatistic,(size_t)
+ geometry_info.rho,(size_t) geometry_info.rho,&(*image)->exception);
if (noise_image != (Image *) NULL)
{
*image=DestroyImage(*image);
}
case ReduceNoisePreview:
{
- preview_image=StatisticImage(thumbnail,NonpeakStatistic,radius,
- exception);
+ preview_image=StatisticImage(thumbnail,NonpeakStatistic,(size_t) radius,
+ (size_t) radius,exception);
(void) FormatMagickString(label,MaxTextExtent,"noise %g",radius);
break;
}
break;
}
}
- preview_image=StatisticImage(thumbnail,NonpeakStatistic,(double) i,
+ preview_image=StatisticImage(thumbnail,NonpeakStatistic,i,i,
exception);
(void) FormatMagickString(label,MaxTextExtent,"+noise %s",factor);
break;
% The format of the StatisticImage method is:
%
% Image *StatisticImage(const Image *image,const StatisticType type,
-% const double radius,ExceptionInfo *exception)
+% const size_t width,const size_t height,ExceptionInfo *exception)
% Image *StatisticImageChannel(const Image *image,
% const ChannelType channel,const StatisticType type,
-% const double radius,ExceptionInfo *exception)
+% const size_t width,const size_t height,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o type: the statistic type (median, mode, etc.).
%
-% o radius: the radius of the pixel neighborhood.
+% o width: the width of the pixel neighborhood.
+%
+% o height: the height of the pixel neighborhood.
%
% o exception: return any errors or warnings in this structure.
%
}
MagickExport Image *StatisticImage(const Image *image,const StatisticType type,
- const double radius,ExceptionInfo *exception)
+ const size_t width,const size_t height,ExceptionInfo *exception)
{
- return(StatisticImageChannel(image,DefaultChannels,type,radius,exception));
+ Image
+ *statistic_image;
+
+ statistic_image=StatisticImageChannel(image,DefaultChannels,type,width,
+ height,exception);
+ return(statistic_image);
}
MagickExport Image *StatisticImageChannel(const Image *image,
- const ChannelType channel,const StatisticType type,const double radius,
- ExceptionInfo *exception)
+ const ChannelType channel,const StatisticType type,const size_t width,
+ const size_t height,ExceptionInfo *exception)
{
#define StatisticImageTag "Statistic/Image"
PixelList
**restrict pixel_list;
- size_t
- width;
-
ssize_t
y;
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
- width=GetOptimalKernelWidth2D(radius,0.5);
statistic_image=CloneImage(image,image->columns,image->rows,MagickTrue,
exception);
if (statistic_image == (Image *) NULL)
if (status == MagickFalse)
continue;
p=GetCacheViewVirtualPixels(image_view,-((ssize_t) width/2L),y-(ssize_t)
- (width/2L),image->columns+width,width,exception);
+ (height/2L),image->columns+width,height,exception);
q=QueueCacheViewAuthenticPixels(statistic_view,0,y,
statistic_image->columns,1,exception);
if ((p == (const PixelPacket *) NULL) || (q == (PixelPacket *) NULL))
ResetPixelList(pixel_list[id]);
for (v=0; v < (ssize_t) width; v++)
{
- for (u=0; u < (ssize_t) width; u++)
+ for (u=0; u < (ssize_t) height; u++)
InsertPixelList(image,r+u,s+u,pixel_list[id]);
r+=image->columns+width;
s+=image->columns+width;
*SharpenImageChannel(const Image *,const ChannelType,const double,
const double,ExceptionInfo *),
*SpreadImage(const Image *,const double,ExceptionInfo *),
- *StatisticImage(const Image *,const StatisticType,const double,ExceptionInfo *),
+ *StatisticImage(const Image *,const StatisticType,const size_t,const size_t,
+ ExceptionInfo *),
*StatisticImageChannel(const Image *,const ChannelType,const StatisticType,
- const double,ExceptionInfo *),
+ const size_t,const size_t,ExceptionInfo *),
*UnsharpMaskImage(const Image *,const double,const double,const double,
const double,ExceptionInfo *),
*UnsharpMaskImageChannel(const Image *,const ChannelType,const double,
clone_image=DestroyImage(clone_image);
if (deskew_image == (Image *) NULL)
return((Image *) NULL);
- median_image=StatisticImage(deskew_image,MedianStatistic,0.0,exception);
+ median_image=StatisticImage(deskew_image,MedianStatistic,3,3,exception);
if (median_image == (Image *) NULL)
{
deskew_image=DestroyImage(deskew_image);
\-scene value image scene number
\-seed value seed a new sequence of pseudo-random numbers
\-size geometry width and height of image
- \-statistic type radius
+ \-statistic type geometry
replace each pixel with corresponding statistic from the neighborhood
\-stretch type render text with this font stretch
\-stroke color graphic primitive stroke color
\-solarize threshold negate all pixels above the threshold level
\-splice geometry splice the background color into the image
\-spread amount displace image pixels by a random amount
- \-statistic type radius
+ \-statistic type geometry
replace each pixel with corresponding statistic from the neighborhood
\-strip strip image of all profiles and comments
\-swirl degrees swirl image pixels about the center
" fill in a image based on a few color points",
"-splice geometry splice the background color into the image",
"-spread radius displace image pixels by a random amount",
- "-statistic type radius",
+ "-statistic type geometry",
" replace each pixel with corresponding statistic from the neighborhood",
"-strip strip image of all profiles and comments",
"-swirl degrees swirl image pixels about the center",
% The format of the MagickStatisticImage method is:
%
% MagickBooleanType MagickStatisticImage(MagickWand *wand,
-% const StatisticType type,const double radius)
+% const StatisticType type,const double width,const size_t height)
% MagickBooleanType MagickStatisticImageChannel(MagickWand *wand,
-% const ChannelType channel,const StatisticType type,const double radius)
+% const ChannelType channel,const StatisticType type,const double width,
+% const size_t height)
%
% A description of each parameter follows:
%
%
*/
WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
- const ChannelType channel,const StatisticType type,const double radius)
+ const ChannelType channel,const StatisticType type,const size_t width,
+ const size_t height)
{
Image
*statistic_image;
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
if (wand->images == (Image *) NULL)
ThrowWandException(WandError,"ContainsNoImages",wand->name);
- statistic_image=StatisticImageChannel(wand->images,channel,type,radius,
+ statistic_image=StatisticImageChannel(wand->images,channel,type,width,height,
wand->exception);
if (statistic_image == (Image *) NULL)
return(MagickFalse);
const ssize_t),
MagickSpreadImage(MagickWand *,const double),
MagickStatisticImage(MagickWand *,const ChannelType,const StatisticType,
- const double),
- MagickStatisticImageChannel(MagickWand *,const StatisticType,const double),
+ const size_t,const size_t),
+ MagickStatisticImageChannel(MagickWand *,const StatisticType,const size_t,
+ const size_t),
MagickStripImage(MagickWand *),
MagickSwirlImage(MagickWand *,const double),
MagickTintImage(MagickWand *,const PixelWand *,const PixelWand *),
(void) SyncImageSettings(mogrify_info,*image);
(void) ParseGeometry(argv[i+1],&geometry_info);
median_image=StatisticImageChannel(*image,channel,MedianStatistic,
- geometry_info.rho,exception);
+ (size_t) geometry_info.rho,(size_t) geometry_info.rho,exception);
if (median_image == (Image *) NULL)
break;
*image=DestroyImage(*image);
(void) SyncImageSettings(mogrify_info,*image);
(void) ParseGeometry(argv[i+1],&geometry_info);
mode_image=StatisticImageChannel(*image,channel,ModeStatistic,
- geometry_info.rho,exception);
+ (size_t) geometry_info.rho,(size_t) geometry_info.rho,exception);
if (mode_image == (Image *) NULL)
break;
*image=DestroyImage(*image);
{
(void) ParseGeometry(argv[i+1],&geometry_info);
noisy_image=StatisticImageChannel(*image,channel,
- NonpeakStatistic,geometry_info.rho,exception);
+ NonpeakStatistic,(size_t) geometry_info.rho,(size_t)
+ geometry_info.rho,exception);
}
else
{
MagickFalse,argv[i+1]);
(void) ParseGeometry(argv[i+2],&geometry_info);
statistic_image=StatisticImageChannel(*image,channel,type,
- geometry_info.rho,exception);
+ (size_t) geometry_info.rho,(size_t) geometry_info.sigma,
+ exception);
if (statistic_image == (Image *) NULL)
break;
*image=DestroyImage(*image);