Minimalistic .NET imaging portable platform
C#
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

README.md

DotImaging logo

NuGet packages version NuGet packages version

DotImaging - .NET array as imaging object
The framework sets focus on .NET native array as primary imaging object, offers extensibility support via extensions, and provides unified platform-abstract imaging IO API.

News

So why DotImaging ?

  • leverages existing .NET structures
  • portable*
  • lightweight
  • so simple, you don't need a help file

*IO and Drawing assemlies depend on OpenCV

Libraries / NuGet packages

Core
  • DotImaging.Image .NET image array extensions. Color and depth conversions. Slim unmanaged structure for fast pixel manipulation.

    Tutorial: Portable Generic Image

//convert to grayscale and flip
Bgr<byte>[,] image = ImageIO.LoadColor("sample.jpg").Clone(); //IO package
Gray<byte>[,] grayIm = image.ToGray()
                               .Flip(FlipDirection.Horizontal);
  • DotImaging.Primitives2D Portable 2D drawing primitives (Point, Size, Rectangle, ...)
IO
  • DotImaging.IO A unified API for IO image access (camera, file, image directory). Portable image loading/saving.

    Tutorial: Portable Imaging IO

var reader = new FileCapture("sample.mp4");
reader.Open();

Bgr<byte>[,] frame = null;
while(true)
{
      reader.ReadTo(ref frame);
      if (frame == null)
         break;

      frame.Show(scaleForm: true); //UI package
}

reader.Close();
  • DotImaging.IO.Web Image or video download/streaming (direct video link or Youtube links).
//------get an image from the Web
new Uri("http://vignette3.wikia.nocookie.net/disney/images/5/5d/Lena_headey_.jpg")
    .GetBytes().DecodeAsColorImage().Show(); //(Show - UI package)

//------stream a video from Youtube
var pipeName = new Uri("https://www.youtube.com/watch?v=Vpg9yizPP_g").NamedPipeFromYoutubeUri(); //Youtube
var reader = new FileCapture(String.Format(@"\\.\pipe\{0}", pipeName)) //IO package

//... (regular stream reading - see IO package sample)
Interoperability
  • DotImaging.BitmapInterop Interoperability extensions between .NET array and Bitmap (WinForms).
var image = new Gray<byte>[240, 320];
var bmp = image.ToBitmap(); //to Bitmap

var imageFromBmp = bmp.ToArray() as Bgr<byte>[,]; //from Bitmap
  • DotImaging.BitmapSourceInterop Interoperability extensions between .NET array and BitmapSource (WPF).
var bmp = new BitmapImage(new Uri("<path>"));
Bgra<byte>[,] colorImg = bmp.ToArray<Bgra<byte>>(); //to bitmap

var imageFromBitmap = colorImg.ToBitmapSource(); //from bitmap
Extensions
  • DotImaging.UI Portable UI elements (image display, progress bar, file/folder dialogs, color-picker, image annotation input).
Bgr<byte>[,] image = new Bgr<byte>[480, 640];
image.Show(); //show image (non-blocking)

(0.4d).Progress(); //progress bar - 40% (non-blocking)

string fileName = UI.OpenFile(); //open-file dialog

Bgr<byte> color = UI.PickColor(); //color-picker dialog

Gray<byte>[,] mask = image.GetMask(); //draw-mask dialog 

RectangleF rect = image.GetRectangle(); //draw-rectangle dialog (blocking and non-blocking)

var num = -1;
UI.ShowMenu(itemNames: new string[] { "2", "3" },
               actions: new Action[] { () => num = 2, () => num = 3 }); //menu-dialog
  • DotImaging.Drawing .NET image drawing array extensions.
//create a managed image
var image = new Bgr<byte>[480, 640];

//draw something
image.Draw(new Rectangle(50, 50, 200, 100), Bgr<byte>.Red, -1);
image.Draw(new Circle(50, 50, 25), Bgr<byte>.Blue, 5);
  • DotImaging.Linq 2D array Linq extensions
//create a managed image
Bgr<byte>[,] image = ...; 

//get the modified blue channel 
var modifiedImage = image.AsEnumerable()
                            .Select(x => x.B / 2)
   						 .ToArray2D(image.Size());
  • DotImaging.Core.Platform Provides a portable way to determine the execution platform + interoperability functions.
Console.WriteLine(Platform.RunningPlatform); //Windows, Linux, MacOS

//add the "UnmanagedLibraries/<OS>/<platform>/" to the path
Platform.AddDllSearchPath(); 

Getting started

  • Just pick what you need. An appropriate readme file will be shown upon selected NuGet package installation.
  • Samples

Want image processing algorithms ?

The framework is the foundation of Accord.NET Extensions which exposes a full power of Accord.NET through extensions!

How to Engage, Contribute and Provide Feedback

Remember: Your opinion is important and will define the future roadmap.

  • questions, comments - message on Github, or write to: darko.juric2 [at] gmail.com
  • spread the word

Final word

If you like the project please star it in order to help to spread the word. That way you will make the framework more significant and in the same time you will motivate me to improve it, so the benefit is mutual.