Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

An example using Nuget plugin 'AnalysisImagePixel' to detection image edge and other functions

Notifications You must be signed in to change notification settings

songshizhao/Analysis-Image-Pixel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Analysis-Image-Pixel

replaced by https://github.com/songshizhao/AnimeGANv2_Sharp which use AnimeGANv2.onnx&opencvsharp

What is it?

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+)

What can this plugin do?

Convert pictures to cartoon style, ignoring facial details and enhancing contrast.
and some other simple add-ons
Here are some effects:
imageimage
imageimage
imageimage
imageimage
imageimage
imageimage
imageimage
imageimage

How to use

Install the Nuget plug-in

PM->Install-Package AnalysisImagePixel
The procedure is to read the picture pixel sits and then call the function to return pixel result

Sample code:

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);

Sample code full(under UWP):

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;

	}
//--
}

Additional features

ImageScale.ScaleImage(byte[] pixels,int width,int height,int desireW,int desireH) //Zoom Image  
ImagePixels.AnsysPixel(byte[] pixels, int width, int height) //Edge detection  

Progress Reporting Interface

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

More information

Full code

About

An example using Nuget plugin 'AnalysisImagePixel' to detection image edge and other functions

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages