C# Class 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:

Inheritance: BaseInPlaceFilter2
Afficher le fichier Open project: accord-net/framework

Méthodes publiques

Méthode Description
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.

Méthodes protégées

Méthode Description
ProcessFilter ( UnmanagedImage image, UnmanagedImage overlay ) : void

Process the filter on the specified image.

Private Methods

Méthode Description
TexturedMerge ( ) : Accord.Imaging.Textures

Method Details

ProcessFilter() protected méthode

Process the filter on the specified image.
protected ProcessFilter ( UnmanagedImage image, UnmanagedImage overlay ) : void
image UnmanagedImage Source image data.
overlay UnmanagedImage Overlay image data.
Résultat void

TexturedMerge() public méthode

Initializes a new instance of the TexturedMerge class.
public TexturedMerge ( ITextureGenerator generator ) : Accord.Imaging.Textures
generator ITextureGenerator Texture generator.
Résultat Accord.Imaging.Textures

TexturedMerge() public méthode

Initializes a new instance of the TexturedMerge class.
public TexturedMerge ( float texture ) : Accord.Imaging.Textures
texture float Generated texture.
Résultat Accord.Imaging.Textures