/// <summary> /// Rectification filter for projective transformation. /// <para>Accord.NET internal call. Please see: <see cref="Accord.Imaging.Filters.Rectification"/> for details.</para> /// </summary> /// <param name="img">Image.</param> /// <param name="homography">The homography matrix used to map a image passed to the filter to the overlay image.</param> /// <param name="fillColor">The filling color used to fill blank spaces.</param> /// <returns>Rectified image.</returns> public static Gray<byte>[,] Rectification(this Gray<byte>[,] img, double[,] homography, Gray<byte> fillColor) { Rectification r = new Rectification(homography); r.FillColor = fillColor.ToColor(); return img.ApplyBaseTransformationFilter(r); }
private void videoSourcePlayer1_NewFrame(object sender, ref Bitmap image) { LevelsLinear16bpp levels = new LevelsLinear16bpp(); levels.InGray = new IntRange(0, 1000); levels.OutGray = new IntRange(0, 65535); levels.ApplyInPlace(image); if (homography != null) { Bitmap img = AForge.Imaging.Image.Convert16bppTo8bpp(image); Rectification rect = new Rectification(homography.Inverse()); image = rect.Apply(img); } }