%
% PolynomialImage() returns a new image where each pixel is the sum of the
% pixels in the image sequence after applying its corresponding terms
-% (coefficients and degree pairs) and a constant.
+% (coefficient and degree pairs) and a constant.
%
% The format of the PolynomialImage method is:
%
"-hald-clut apply a Hald color lookup table to the image",
"-morph value morph an image sequence",
"-mosaic create a mosaic from an image sequence",
+ "-poly terms build a polynomial from the image sequence and the corresponding",
+ " terms (coefficients and degree pairs + constant).",
"-print string interpret string and print to console",
"-process arguments process the image with a custom image filter",
"-smush geometry smush an image sequence together",
i++;
if (i == (ssize_t) (argc-1))
ThrowConvertException(OptionError,"MissingArgument",option);
+ if (IsGeometry(argv[i]) == MagickFalse)
+ ThrowConvertInvalidArgumentException(option,argv[i]);
break;
}
if (LocaleCompare("alpha",option+1) == 0)
ThrowConvertInvalidArgumentException(option,argv[i]);
break;
}
+ if (LocaleCompare("poly",option+1) == 0)
+ {
+ if (*option == '+')
+ break;
+ i++;
+ if (i == (ssize_t) (argc-1))
+ ThrowConvertException(OptionError,"MissingArgument",option);
+ if (IsGeometry(argv[i]) == MagickFalse)
+ ThrowConvertInvalidArgumentException(option,argv[i]);
+ break;
+ }
if (LocaleCompare("posterize",option+1) == 0)
{
if (*option == '+')
alpha_type;
(void) SyncImageSettings(mogrify_info,*image,exception);
- alpha_type=(AlphaChannelOption) ParseCommandOption(MagickAlphaChannelOptions,
- MagickFalse,argv[i+1]);
+ alpha_type=(AlphaChannelOption) ParseCommandOption(
+ MagickAlphaChannelOptions,MagickFalse,argv[i+1]);
(void) SetImageAlphaChannel(*image,alpha_type,exception);
break;
}
interpolate_method,exception);
break;
}
+ if (LocaleCompare("poly",option+1) == 0)
+ {
+ char
+ *args,
+ token[MaxTextExtent];
+
+ const char
+ *p;
+
+ double
+ *arguments;
+
+ register ssize_t
+ x;
+
+ size_t
+ number_arguments;
+
+ /*
+ Polynomial image.
+ */
+ (void) SyncImageSettings(mogrify_info,*image,exception);
+ args=InterpretImageProperties(mogrify_info,*image,argv[i+2],
+ exception);
+ if (args == (char *) NULL)
+ break;
+ p=(char *) args;
+ for (x=0; *p != '\0'; x++)
+ {
+ GetMagickToken(p,&p,token);
+ if (*token == ',')
+ GetMagickToken(p,&p,token);
+ }
+ number_arguments=(size_t) x;
+ arguments=(double *) AcquireQuantumMemory(number_arguments,
+ sizeof(*arguments));
+ if (arguments == (double *) NULL)
+ ThrowWandFatalException(ResourceLimitFatalError,
+ "MemoryAllocationFailed",(*image)->filename);
+ (void) ResetMagickMemory(arguments,0,number_arguments*
+ sizeof(*arguments));
+ p=(char *) args;
+ for (x=0; (x < (ssize_t) number_arguments) && (*p != '\0'); x++)
+ {
+ GetMagickToken(p,&p,token);
+ if (*token == ',')
+ GetMagickToken(p,&p,token);
+ arguments[x]=StringToDouble(token,(char **) NULL);
+ }
+ args=DestroyString(args);
+ mogrify_image=PolynomialImage(*image,number_arguments >> 1,
+ arguments,exception);
+ arguments=(double *) RelinquishMagickMemory(arguments);
+ }
if (LocaleCompare("posterize",option+1) == 0)
{
/*
"-hald-clut apply a Hald color lookup table to the image",
"-morph value morph an image sequence",
"-mosaic create a mosaic from an image sequence",
+ "-poly terms build a polynomial from the image sequence and the corresponding",
+ " terms (coefficients and degree pairs + constant).",
"-print string interpret string and print to console",
"-process arguments process the image with a custom image filter",
"-smush geometry smush an image sequence together",
ThrowMogrifyInvalidArgumentException(option,argv[i]);
break;
}
+ if (LocaleCompare("poly",option+1) == 0)
+ {
+ if (*option == '+')
+ break;
+ i++;
+ if (i == (ssize_t) argc)
+ ThrowMogrifyException(OptionError,"MissingArgument",option);
+ if (IsGeometry(argv[i]) == MagickFalse)
+ ThrowMogrifyInvalidArgumentException(option,argv[i]);
+ break;
+ }
if (LocaleCompare("posterize",option+1) == 0)
{
if (*option == '+')
_image->interpolate,_exception);
break;
}
+ if (LocaleCompare("poly",option+1) == 0)
+ {
+ double
+ *args;
+
+ ssize_t
+ count;
+
+ /* convert argument string into an array of doubles */
+ args = StringToArrayOfDoubles(arg2,&count,_exception);
+ if (args == (double *)NULL )
+ CLIWandExceptArgBreak(OptionError,"InvalidNumberList",option,arg2);
+ new_image=PolynomialImage(_image,count >> 1,args,_exception);
+ args=(double *) RelinquishMagickMemory(args);
+ break;
+ }
if (LocaleCompare("posterize",option+1) == 0)
{
flags=ParseGeometry(arg1,&geometry_info);
{"width", IntegerReference},{"height", IntegerReference},
{"channel", MagickChannelOptions}, {"type", MagickStatisticOptions} } },
{ "Perceptible", { {"epsilon", RealReference},
+ {"channel", MagickChannelOptions} } },
+ { "Poly", { {"terms", ArrayReference},
{"channel", MagickChannelOptions} } }
};
StatisticImage = 270
Perceptible = 271
PerceptibleImage = 272
+ Poly = 273
+ PolyImage = 274
MogrifyRegion = 666
PPCODE:
{
(void) SetImageChannelMask(image,channel_mask);
break;
}
+ case 136: /* Poly */
+ {
+ AV
+ *av;
+
+ double
+ *terms;
+
+ size_t
+ number_terms;
+
+ if (attribute_flag[0] == 0)
+ break;
+ if (attribute_flag[1] != 0)
+ channel=(ChannelType) argument_list[1].integer_reference;
+ av=(AV *) argument_list[0].array_reference;
+ number_terms=(size_t) av_len(av);
+ terms=(double *) AcquireQuantumMemory(number_terms,sizeof(*terms));
+ if (terms == (double *) NULL)
+ {
+ ThrowPerlException(exception,ResourceLimitFatalError,
+ "MemoryAllocationFailed",PackageName);
+ goto PerlException;
+ }
+ for (j=0; j < av_len(av); j++)
+ terms[j]=(double) SvNV(*(av_fetch(av,j,0)));
+ image=PolynomialImage(image,number_terms >> 1,terms,exception);
+ terms=(double *) RelinquishMagickMemory(terms);
+ break;
+ }
}
if (next != (Image *) NULL)
(void) CatchImageException(next);
\-fx expression apply mathematical expression to an image channel(s)
\-hald-clut apply a Hald color lookup table to the image
\-morph value morph an image sequence
- \-mosaic create a mosaic from an image sequence
+ \- osaic create a mosaic from an image sequence
+ \-poly terms build a polynomial from the image sequence and the corresponding terms (coefficients and degree pairs + constant)
\-process arguments process the image with a custom image filter
\-separate separate an image channel into a grayscale image
\-smush geometry smush an image sequence together
\-hald-clut apply a Hald color lookup table to the image
\-morph value morph an image sequence
\-mosaic create a mosaic from an image sequence
+ \-poly terms build a polynomial from the image sequence and the corresponding terms (coefficients and degree pairs + constant)
\-process arguments process the image with a custom image filter
\-separate separate an image channel into a grayscale image
\-smush geometry smush an image sequence together