cureos / aforge

PCL version of AForge.NET Framework, https://code.google.com/p/aforge/
Other
125 stars 96 forks source link
Portable AForge.NET logo

Portable AForge.NET Framework

AForge.NET Framework: Copyright (c) 2006-2013 AForge.NET; licensed under Lesser General Public License (LGPL) version 3.
Shim.Drawing class libraries: Copyright (c) 2013-2016 Anders Gustafsson, Cureos AB; licensed under General Public License (GPL) version 3.

This project is a fork of Andrew Kirillow's original AForge.NET Framework project. For general information and tutorials, see here.

The repository currently provides:

The Portable AForge.NET class libraries depend on the PCL Shim and/or Shim.Drawing assemblies. In applications however, the target specific Shim and Shim.Drawing assemblies should be referenced, to ensure that the target specific version of each type is used.

Installation

The preferred method for using Portable AForge.NET in your application is to download the required packages, including dependencies, from NuGet. Open the NuGet Package Manager in Visual Studio and search for portable.aforge to obtain a list of the currently available packages on NuGet.

Usage

WriteableBitmap:s provide input and output to the imaging functionality in the WPF and Windows Phone Silverlight libraries. The target specific Shim.Drawing assembly incorporates explicit cast operators between WriteableBitmap and System.Drawing.Bitmap.

All image processing is performed on the mock System.Drawing.Bitmap class, WriteableBitmap objects should only be used as initial input to and final output from the image processing.

When using the WPF Shim.Drawing assembly, the System.Drawing assembly from .NET Framework cannot be referenced since this would lead to type name collisions. If there is a need to reference the real System.Drawing assembly, you are recommended to use the original AForge.NET Framework libraries and use WPF hosting controls to display image processing results instead.

This same approach can be applied in WPF and Windows Phone Silverlight applications.

// Use explicit operator to convert from WriteableBitmap to Bitmap
Bitmap bitmap = (Bitmap)aWriteableBitmapObject;

// Apply one or more filter functions on the Bitmap object
var filter1 = AForge.Imaging.Filters.Grayscale.CommonAlgorithms.RMY;
bitmap = filter1.Apply(bitmap);
var filter2 = new AForge.Imaging.Filters.CannyEdgeDetector();
filter2.ApplyInPlace(bitmap);

// Use explicit operator to convert back from Bitmap to WriteableBitmap
aWriteableBitmapObject = (WriteableBitmap)bitmap;

Building the libraries

The preferred method for including Portable AForge.NET in your application is NuGet. However, if you prefer to build the libraries by yourself, follow these guidelines:

IMPORTANT!

Notes on commercial use

The Shim.Drawing assemblies that are required to build the Portable Class Library version of AForge.NET Framework are published under the General Public License, version 3.

There are Shim and Shim.Drawing assemblies available for Xamarin.Android and Xamarin.iOS, making it possible to incorporate Portable AForge assemblies in Android and iPhone or iPad apps. See for example this blog post.

Shim Drawing is available for evaluation from NuGet for all supported platforms. For non-evaluation copies of Shim Drawing, please contact Cureos.

Please note that AForge.NET Framework itself is licensed under LGPL version 3, and the copyright holder states the following on the AForge.NET Framework web site:

Regarding collaboration, contribution, offers, partnering, custom work/consulting, none GPL/LGPL licensing, etc., please, contact using the next e-mail: aforge.net [at] gmail {dot} com