}
/*
Blur Image by resampling.
+ FUTURE: this is currently broken, especially for small sigma blurs
+ This needs to be fixed to use a non-user filter setup that provides
+ far more control than currently available.
*/
resample_filter=AcquireResampleFilter(image,exception);
- SetResampleFilter(resample_filter,CubicFilter);
+ SetResampleFilter(resample_filter,CubicFilter); /* was blur*2 */
destination_view=AcquireCacheView(destination_image);
composite_view=AcquireCacheView(composite_image);
for (y=0; y < (ssize_t) composite_image->rows; y++)
return((Image *) NULL);
picture_image=rotate_image;
picture_image->background_color=image->background_color;
- polaroid_image=ShadowImage(picture_image,80.0,0.0,quantum/3,quantum/3,
+ polaroid_image=ShadowImage(picture_image,80.0,2.0,quantum/3,quantum/3,
exception);
if (polaroid_image == (Image *) NULL)
{
*/
(void) QueryColorCompliance("#0000",AllCompliance,
&image->background_color,exception);
- shadow_image=ShadowImage(image,80.0,0.0,5,5,exception);
+ shadow_image=ShadowImage(image,80.0,2.0,5,5,exception);
if (shadow_image != (Image *) NULL)
{
(void) CompositeImage(shadow_image,OverCompositeOp,image,0,0,
extern MagickPrivate Image
*MorphologyApply(const Image *,const MorphologyMethod,const ssize_t,
- const KernelInfo *,const CompositeOperator,ExceptionInfo *);
+ const KernelInfo *,const CompositeOperator,const double,ExceptionInfo *);
extern MagickPrivate void
ShowKernelInfo(const KernelInfo *),
%
% More specifically kernels are not normalized/scaled/blended by the
% 'convolve:scale' Image Artifact (setting), nor is the convolve bias
-% (-bias setting or image->bias) loooked at, but must be supplied from the
+% ('convolve:bias' artifact) looked at, but must be supplied from the
% function arguments.
%
% The format of the MorphologyApply method is:
%
% Image *MorphologyApply(const Image *image,MorphologyMethod method,
% const ssize_t iterations,const KernelInfo *kernel,
-% const CompositeMethod compose,ExceptionInfo *exception)
+% const CompositeMethod compose,const double bias,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% If 'NoCompositeOp' force image to be re-iterated by each kernel.
% Otherwise merge the results using the compose method given.
%
+% o bias: Convolution Output Bias.
+%
% o exception: return any errors or warnings in this structure.
%
*/
** for result convergence determination.
*/
static ssize_t MorphologyPrimitive(const Image *image,Image *morphology_image,
- const MorphologyMethod method,const KernelInfo *kernel,
+ const MorphologyMethod method,const KernelInfo *kernel,const double bias,
ExceptionInfo *exception)
{
#define MorphologyTag "Morphology/Image"
result.green =
result.blue =
result.alpha =
- result.black = 0.0;
+ result.black = bias;
/* Weighted Average of pixels using reflected kernel
result.green =
result.blue =
result.alpha =
- result.black = 0.0;
+ result.black = bias;
break;
case DilateIntensityMorphology:
case ErodeIntensityMorphology:
*/
MagickPrivate Image *MorphologyApply(const Image *image,
const MorphologyMethod method, const ssize_t iterations,
- const KernelInfo *kernel, const CompositeOperator compose,
+ const KernelInfo *kernel, const CompositeOperator compose,const double bias,
ExceptionInfo *exception)
{
CompositeOperator
/* APPLY THE MORPHOLOGICAL PRIMITIVE (curr -> work) */
count++;
changed = MorphologyPrimitive(curr_image, work_image, primitive,
- this_kernel, exception);
+ this_kernel, bias, exception);
if ( verbose == MagickTrue ) {
if ( kernel_loop > 1 )
% the above internal function MorphologyApply().
%
% User defined settings include...
-% * Output Bias for Convolution and correlation ("-bias")
-% * Kernel Scale/normalize settings ("-set 'option:convolve:scale'")
+% * Output Bias for Convolution and correlation ('-define convolve:bias=??")
+% * Kernel Scale/normalize settings ("-define convolve:scale=??")
% This can also includes the addition of a scaled unity kernel.
-% * Show Kernel being applied ("-set option:showkernel 1")
+% * Show Kernel being applied ("-define showkernel=1")
%
% The format of the MorphologyImage method is:
%
Image
*morphology_image;
+ double
+ bias;
/* Apply Convolve/Correlate Normalization and Scaling Factors.
* This is done BEFORE the ShowKernelInfo() function is called so that
* users can see the results of the 'option:convolve:scale' option.
*/
curr_kernel = (KernelInfo *) kernel;
+ bias=0.0; /* curr_kernel->bias; should we get from kernel */
if ( method == ConvolveMorphology || method == CorrelateMorphology )
{
const char
*artifact;
+
artifact = GetImageArtifact(image,"convolve:scale");
if ( artifact != (const char *)NULL ) {
if ( curr_kernel == kernel )
}
ScaleGeometryKernelInfo(curr_kernel, artifact);
}
+
+ artifact = GetImageArtifact(image,"convolve:bias");
+ compose = UndefinedCompositeOp; /* use default for method */
+ if ( artifact != (const char *) NULL)
+ bias=StringToDouble(artifact, (char **) NULL);
}
/* display the (normalized) kernel via stderr */
*/
{ const char
*artifact;
- artifact = GetImageArtifact(image,"morphology:compose");
compose = UndefinedCompositeOp; /* use default for method */
+ artifact = GetImageArtifact(image,"morphology:compose");
if ( artifact != (const char *) NULL)
compose=(CompositeOperator) ParseCommandOption(MagickComposeOptions,
MagickFalse,artifact);
}
/* Apply the Morphology */
- morphology_image=MorphologyApply(image,method,iterations,curr_kernel,compose,
- exception);
+ morphology_image = MorphologyApply(image,method,iterations,
+ curr_kernel,compose,bias,exception);
/* Cleanup and Exit */
if ( curr_kernel != kernel )
{ "filter", FilterInterpolatePixel, UndefinedOptionFlag, MagickFalse },
{ "Integer", IntegerInterpolatePixel, UndefinedOptionFlag, MagickFalse },
{ "Mesh", MeshInterpolatePixel, UndefinedOptionFlag, MagickFalse },
+ { "Nearest", NearestNeighborInterpolatePixel, UndefinedOptionFlag, MagickFalse },
{ "NearestNeighbor", NearestNeighborInterpolatePixel, UndefinedOptionFlag, MagickFalse },
{ "Spline", SplineInterpolatePixel, UndefinedOptionFlag, MagickFalse },
{ (char *) NULL, UndefinedInterpolatePixel, UndefinedOptionFlag, MagickFalse }
kernel_info=AcquireKernelInfo(argv[i+1]);
if (kernel_info == (KernelInfo *) NULL)
break;
+ /* kernel_info->bias=(*image)->bias; -- FUTURE: check this path! */
mogrify_image=ConvolveImage(*image,kernel_info,exception);
kernel_info=DestroyKernelInfo(kernel_info);
break;
*/
if (IfSetOption && IsGeometry(arg1) == MagickFalse)
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
- (void) SetImageOption(_image_info,option+1,ArgOption("0"));
+ (void) SetImageOption(_image_info,"convolve:bias",ArgOption(NULL));
break;
}
if (LocaleCompare("black-point-compensation",option+1) == 0)
if (parse < 0)
CLIWandExceptArgBreak(OptionError,"UnrecognizedEndianType",
option,arg1);
+ /* FUTURE: check alloc/free of endian string! - remove? */
_image_info->endian=(EndianType) (*arg1);
(void) SetImageOption(_image_info,option+1,arg1);
break;
kernel_info=AcquireKernelInfo(arg1);
if (kernel_info == (KernelInfo *) NULL)
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
+ /* kernel_info->bias=_image->bias; -- FUTURE: check this path! */
new_image=ConvolveImage(_image,kernel_info,_exception);
kernel_info=DestroyKernelInfo(kernel_info);
break;
}
if (LocaleCompare("resample",option+1) == 0)
{
- /* Roll into a resize special operation */
+ /* FUTURE: Roll into a resize special operation */
if (IsGeometry(arg1) == MagickFalse)
CLIWandExceptArgBreak(OptionError,"InvalidArgument",option,arg1);
flags=ParseGeometry(arg1,&geometry_info);