public override void Process(ref Image <Bgr, byte> image)
{
// the un-warped perspective
var src = new[]
{
new PointF(0, 0),
new PointF(image.Width, 0),
new PointF(image.Width, image.Height),
new PointF(0, image.Height)
};
// the warped perspective
var dst = new[]
{
new PointF(_p1X, _p1Y),
new PointF(_p2X, _p2Y),
new PointF(_p3X, _p3Y),
new PointF(_p4X, _p4Y)
};
// get the perspective transformation matrix
using (var mat = CvInvoke.GetPerspectiveTransform(src, dst))
{
// apply the matrix
CvInvoke.WarpPerspective(
image,
image,
mat,
new Size(_width, _height),
_interpolationType,
_warpType,
(BorderType)_borderType,
new Bgr(_backgroundColor.Color()).MCvScalar);
}
}