Merge two images using factors from texture.

Namespace:  AForge.Imaging.Filters
Assembly:  AForge.Imaging (in AForge.Imaging.dll) Version: 2.2.5.0 (2.2.5.0)

Syntax

C#
public class TexturedMerge : BaseInPlaceFilter2

Remarks

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 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:

CopyC#
// 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:

CopyC#
// 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 Hierarchy

See Also