/// <summary> /// Executes specified filter on an image. As destination image size may be different from source; in-place filtering is not allowed. /// </summary> /// <param name="img">Image.</param> /// <param name="filter">AForge <see cref="BaseTransformationFilter"/>.</param> public static TColor[,] ApplyBaseResizeFilter <TColor>(this TColor[,] img, BaseResizeFilter filter) where TColor : struct, IColor { TColor[,] dest = new TColor[filter.NewHeight, filter.NewWidth]; using (var uImg = img.Lock()) using (var uDest = dest.Lock()) { filter.Apply(uImg.AsAForgeImage(), uDest.AsAForgeImage()); } return(dest); }