Page 1 of 1

-sparse-color doc?

Posted: 2008-08-26T14:50:57-07:00
by rmagick
There's a distinct lack of doc for -sparse-color in the utilities options documentation (http://www.imagemagick.org/script/comma ... ptions.php). I know -sparse-color is still pretty new so I'm thinking that it's a deliberate omission. What's the deal?

Re: -sparse-color doc?

Posted: 2008-08-26T16:29:17-07:00
by fmw42
Sorry to stick my nose in here, but I think Anthony is still working on it. I think he has an initial development that works, but I believe he is still working on the issues of different ways to specify colors. I suspect that it was an oversight, accidentally premature, in -sparse-color showing on the options page with no information linked in. He does not yet show any information on his canvas gradients examples page. That is why I think it is still in the works.

I believe that he is developing the following methods: barycentric, bilinear, shepards and voronoi.

One will be able to specify a few random or well-placed points of color and the sparse-color option will "interpolate" the colors to fill out the image according to one of those methods.

I will leave the rest to Anthony to fill in when he gets online.

Re: -sparse-color doc?

Posted: 2008-08-26T17:29:58-07:00
by anthony
fmw42 wrote:I believe that he is developing the following methods: barycentric, bilinear, shepards and voronoi.

One will be able to specify a few random or well-placed points of color and the sparse-color option will "interpolate" the colors to fill out the image according to one of those methods.

-sparse-color is still in development, but is working.

Basically as of the last few release you can specify

Code: Select all

    convert  {some image}  \
        -sparse-color {method}  'x,y color   x,y color   x,y color ...' \
        {output processing and saving}
It will try to set the color given at each of the floating point coordinates, and then map the rest of the image to try and best fit those colors.
  • voronoi map to nearest color point
  • shepards use a inverse square (like gravity wells) spreading out to an average of the colors at infinity
  • barycentric three point triangle of color forming a linear gradients in each channel. Essentually a 3 color affine linear equation fit to three points. If two points are given a thrid is generated to form a simple linear gradiant between the two points (diagonal gradients!).
  • bilinear try to bestfit a 4 point bilinear equation to the points (not a great result and may be deleted from the final method list).
All this is not final, and even the options may not remain in the 'x,y color' form, though I will try to keep it that way.

Ideas and other types coloring methods based on sparsely separated points will also be welcome.

For example I am considering allowing the use of '%' escapes in arguments (ditto for -distort).

Also a '+' form of +sparse-color will take just a simple list of coordinates (no colors) and read the colors from the given image at those points. That will allow you to 'recreate' backgrounds that exists under text and foreground objects to allow better background removal!

I am also planing a 'delaney triangular mesh' set of algorithms, with barycentric fill or triangular spline fill. But it takes time.

NOTHING however is settled! Ideas are welcome.


PS: I am also considering another option -mark-points which will draw symbols (See Drawing Symbols as a List of Points that was recently added) and the triangulation between the points. Though this may in fact be added to the -draw MVG language instead of a new option. This will help users mark out images in various ways, letting you mark and check various reference points for distortions and drawing methods.


Too much to do, not enough time to do it.

I have Barrel Distortion documentation to complete, and other Distortions to add. That includes distortions based on a 'delaney triangular mesh' which will give IM a great boost toward the ability to do spatial morphs. That is morphs similar to what Fred Weinhaus was able to generate using a simple (single point move) form of the 'Shepards' Distortion, See his "shapemorph" script.


I am also considering how to add a Perlin Noise Generator (in a tileable 'time referencing' method.

As well as improvements to the Plasma Fractal Generator, which internally accepts a image to modify (like a gradient: image in the currentplasma: operator)

Re: -sparse-color doc?

Posted: 2008-08-26T23:09:08-07:00
by anthony
UPDATE., examples and docs are done.

They will appear online in the next day or so at
http://www.imagemagick.org/Usage/canvas/#sparse-color

as well as in the command line options page.

Re: -sparse-color doc?

Posted: 2008-08-27T14:30:35-07:00
by rmagick
Excellent! Thanks!