protected override void ProcessFilter(UnmanagedImage sourceData, UnmanagedImage destinationData)
{
if (sourceData.PixelFormat == PixelFormat.Format8bppIndexed)
sourceData = toRGB.Apply(sourceData);
// Copy image contents
sourceData.Copy(destinationData);
Bitmap managedImage = destinationData.ToManagedImage(makeCopy: false);
using (Graphics g = Graphics.FromImage(managedImage))
using (Pen positive = new Pen(Color.Red))
using (Pen negative = new Pen(Color.Blue))
using (Pen line = new Pen(Color.FromArgb(0, 255, 0)))
{
// mark all points
foreach (SpeededUpRobustFeaturePoint p in points)
{
int S = (int)(scale * p.Scale);
int R = (int)(S / 2f);
Point pt = new Point((int)p.X, (int)p.Y);
Point ptR = new Point((int)(R * System.Math.Cos(p.Orientation)),
(int)(R * System.Math.Sin(p.Orientation)));
Pen myPen = (p.Laplacian > 0 ? negative : positive);
g.DrawEllipse(myPen, pt.X - R, pt.Y - R, S, S);
g.DrawLine(line, new Point(pt.X, pt.Y), new Point(pt.X + ptR.X, pt.Y + ptR.Y));
}
}
}
}