Page 2 of 2

Re: Fill area with nearest colour from boundary

Posted: 2016-10-19T12:32:13-07:00
by fmw42
Snibgo: Terrific pepper processing!

Re: Fill area with nearest colour from boundary

Posted: 2016-10-19T19:28:07-07:00
by anthony
snibgo... Are you sure your blurFill.bat doesn't 'leak' across boundaries?
This is the difference between a shepard's fill and a color diffusion

See... the 'leak' example on...
http://www.imagemagick.org/Usage/canvas ... ds_leakage

If color diffusion was used on that example only the areas between the lines will have a gradient. There will be no 'pink' color as you get distant.

Still I amazed your example came out so well, and shows the power of diffusion curves when you consider the original lines are stored as vector data, and not a pixel array.

Re: Fill area with nearest colour from boundary

Posted: 2016-10-20T04:42:35-07:00
by snibgo
blurFill.bat can leak colours across boundaries, but doesn't noticeably in this example. This example has lines 3 pixels thick, and I used "-blur 0x1" so the blur doesn't noticeably leak for that distance.

The colour diffusion method carries more data about the lines than merely the colour at each point. Each line is: the Bezier geometry, and the colour at each point on the two sides (and a blur).

Fortunately for me, they rasterized the vector lines by a pair of lines of pixels, each 3 pixels thick. If they had been thinner, I could have used a smaller blur sigma (or radius) for the first few blurs.

Representing diffusion curves in pure raster format would need at least 7 channels: 3 colour channels for one side, 3 for the other side, and 1 for the blur.


Incidentally, on the speed of "-sparse-color Voronoi": the current IM implementation is brute-force. Faster algorithms are available, such as Fortune's algorithm, at the cost of much greater complexity.

Re: Fill area with nearest colour from boundary

Posted: 2016-10-20T21:48:20-07:00
by anthony
I see the blurs are small enough that the 'diffusion' can't get past because of the the write mask (or restoration of edge pixels).

The fast voroni method I en-visualised was using a distance morphology much like... Constrained Distance
http://www.imagemagick.org/Usage/morpho ... nstrainted

It would using the new IMv7 write masks, that would allow the algorithm to understand that some pixels do not need to be re-calculated, and as such know when no more iterations is needed. The distance however would be stored in a separate channel, and color channels copied when shorter distances are found. Something like this is talked about in the Color Diffusion paper to generate an initial starting point, as it is very fast.

In IMv6 the write mask was accessible from the algorithm implementation level (it was done only at lower levels) so the algorithm did not know if the current pixel was in fact writable or not. It it did, many algorithms could speed up by skipping those pixels that can't change.