protected override unsafe void ProcessFilter(UnmanagedImage image)
{
// get border point which is still in the line
IntPoint a = new IntPoint(0, 0);
IntPoint b = new IntPoint(0, image.Height);
IntPoint c = new IntPoint(image.Width, 0);
IntPoint d = new IntPoint(image.Width, image.Height);
LineSegment top = new LineSegment(a, c);
LineSegment left = new LineSegment(a, b);
LineSegment right = new LineSegment(c, d);
LineSegment bottom = new LineSegment(b, d);
Accord.Point?[] points = new Accord.Point?[4];
points[0] = line.GetIntersectionWith(bottom);
points[1] = line.GetIntersectionWith(left);
points[2] = line.GetIntersectionWith(right);
points[3] = line.GetIntersectionWith(top);
IntPoint? p1 = null;
IntPoint? p2 = null;
foreach (var p in points)
{
if (p == null)
continue;
if (p1 == null)
{
p1 = p.Value.Round();
continue;
}
p2 = p.Value.Round();
break;
}
IntPoint start = new IntPoint(image.Width - p1.Value.X, p1.Value.Y);
IntPoint end = new IntPoint(image.Width - p2.Value.X, p2.Value.Y);
Drawing.Line(image, start, end, markerColor);
}
}