replaced by https://github.com/songshizhao/AnimeGANv2_Sharp which use AnimeGANv2.onnx&opencvsharp
This is an example for Nuget plugin ‘AnalysisImagePixel’ AnalysisImagePixel plugin code is written under .net standard 2.0, so it can be used in App under UWP/.Net Framework(4.6.x+)
Convert pictures to cartoon style, ignoring facial details and enhancing contrast.
and some other simple add-ons
Here are some effects:
PM->Install-Package AnalysisImagePixel
The procedure is to read the picture pixel sits and then call the function to return pixel result
var pixels = await bitmapDecoder.GetPixelDataAsync();
//----------------------------------------------------------
MainFunction main = new MainFunction();
main.MsgReporter = this;// optional
var resultPixels=await main.Run(pixels.DetachPixelData(), (int)bitmapDecoder.PixelWidth, (int)bitmapDecoder.PixelHeight);
using (var stream= await file.OpenReadAsync())
{
_bitmap = new BitmapImage();
await _bitmap.SetSourceAsync(stream);
Image1.Source = _bitmap;
//
BitmapDecoder bitmapDecoder = await BitmapDecoder.CreateAsync(stream);
//
var pixels = await bitmapDecoder.GetPixelDataAsync();
//----------------------------------------------------------
MainFunction main = new MainFunction();
main.MsgReporter = this;// optional
var resultPixels=await main.Run(pixels.DetachPixelData(), (int)bitmapDecoder.PixelWidth, (int)bitmapDecoder.PixelHeight);
//
using (var ms = new InMemoryRandomAccessStream())
{
float devicedpi = Windows.Graphics.Display.DisplayInformation.GetForCurrentView().LogicalDpi;
var encoder = await BitmapEncoder.CreateAsync(BitmapEncoder.PngEncoderId, ms);
encoder.SetPixelData(BitmapPixelFormat.Bgra8, BitmapAlphaMode.Ignore,bitmapDecoder.PixelWidth,bitmapDecoder.PixelHeight, devicedpi, devicedpi, resultPixels);
await encoder.FlushAsync();
var _bitmap2 = new BitmapImage();
await _bitmap2.SetSourceAsync(ms);
Image2.Source = _bitmap2;
}
//--
}
ImageScale.ScaleImage(byte[] pixels,int width,int height,int desireW,int desireH) //Zoom Image
ImagePixels.AnsysPixel(byte[] pixels, int width, int height) //Edge detection
Because it takes a long time to perform facial detail neglect calculations, IProgressMsg, an interface that provides a progress report, is implemented to report the conversion progress