I couldn't find anything in Magick.NET documentation about SparseColors() method and it get's me confused.
I'm trying to recreate the effect of convert -sparse-color shepards "..." command line parameter. As far as I understand it gets a list of {X,Y COLOR} objects.
MagickImage.SparseColors() asks for Channel, SparseColorMethod and an array of double coordinates in his parameters.
What I did is the following:
Code: Select all
var coords = GetCoords(points);
image.SparseColor(Channels.All, SparseColorMethod.Shepards, coords);
Code: Select all
private double[] GetCoords(Point[] points)
{
var list = new List<double>();
for (var i = 0; i < points.Length; i++)
{
var p = points[i];
var c = colors[i];
list.Add(p.X);
list.Add(p.Y);
}
return list.ToArray();
}