C# Класс Accord.Imaging.Filters.TexturedMerge

Merge two images using factors from texture.

The filter is similar to Morph filter in its idea, but instead of using single value for balancing amount of source's and overlay's image values (see Morph.SourcePercent), the filter uses texture, which determines the amount to take from source image and overlay image.

The filter uses specified texture to adjust values using the next formula:
dst = src * textureValue + ovr * ( 1.0 - textureValue ),
where src is value of pixel in a source image, ovr is value of pixel in overlay image, dst is value of pixel in a destination image and textureValue is corresponding value from provided texture (see TextureGenerator or Texture).

The filter accepts 8 bpp grayscale and 24 bpp color images for processing.

Sample usage #1:

// create filter TexturedMerge filter = new TexturedMerge( new TextileTexture( ) ); // create an overlay image to merge with filter.OverlayImage = new Bitmap( image.Width, image.Height, PixelFormat.Format24bppRgb ); // fill the overlay image with solid color PointedColorFloodFill fillFilter = new PointedColorFloodFill( Color.DarkKhaki ); fillFilter.ApplyInPlace( filter.OverlayImage ); // apply the merge filter filter.ApplyInPlace( image );

Sample usage #2:

// create filter TexturedMerge filter = new TexturedMerge( new CloudsTexture( ) ); // create 2 images with modified Hue HueModifier hm1 = new HueModifier( 50 ); HueModifier hm2 = new HueModifier( 200 ); filter.OverlayImage = hm2.Apply( image ); hm1.ApplyInPlace( image ); // apply the merge filter filter.ApplyInPlace( image );

Initial image:

Result image #1:

Result image #2:

Наследование: BaseInPlaceFilter2
Показать файл Открыть проект

Открытые методы

Метод Описание
TexturedMerge ( ITextureGenerator generator ) : Accord.Imaging.Textures

Initializes a new instance of the TexturedMerge class.

TexturedMerge ( float texture ) : Accord.Imaging.Textures

Initializes a new instance of the TexturedMerge class.

Защищенные методы

Метод Описание
ProcessFilter ( UnmanagedImage image, UnmanagedImage overlay ) : void

Process the filter on the specified image.

Приватные методы

Метод Описание
TexturedMerge ( ) : Accord.Imaging.Textures

Описание методов

ProcessFilter() защищенный Метод

Process the filter on the specified image.
protected ProcessFilter ( UnmanagedImage image, UnmanagedImage overlay ) : void
image UnmanagedImage Source image data.
overlay UnmanagedImage Overlay image data.
Результат void

TexturedMerge() публичный Метод

Initializes a new instance of the TexturedMerge class.
public TexturedMerge ( ITextureGenerator generator ) : Accord.Imaging.Textures
generator ITextureGenerator Texture generator.
Результат Accord.Imaging.Textures

TexturedMerge() публичный Метод

Initializes a new instance of the TexturedMerge class.
public TexturedMerge ( float texture ) : Accord.Imaging.Textures
texture float Generated texture.
Результат Accord.Imaging.Textures