Click or drag to resize
Accord.NET (logo)

TexturedMerge Class

Merge two images using factors from texture.
Inheritance Hierarchy
SystemObject
  Accord.Imaging.FiltersBaseInPlaceFilter
    Accord.Imaging.FiltersBaseInPlaceFilter2
      Accord.Imaging.FiltersTexturedMerge

Namespace:  Accord.Imaging.Filters
Assembly:  Accord.Imaging (in Accord.Imaging.dll) Version: 3.7.0
Syntax
public class TexturedMerge : BaseInPlaceFilter2
Request Example View Source

The TexturedMerge type exposes the following members.

Constructors
Properties
  NameDescription
Public propertyFormatTranslations
Format translations dictionary.
(Overrides BaseInPlaceFilterFormatTranslations.)
Public propertyOverlayImage
Overlay image.
(Inherited from BaseInPlaceFilter2.)
Public propertyTexture
Generated texture.
Public propertyTextureGenerator
Texture generator.
Public propertyUnmanagedOverlayImage
Unmanaged overlay image.
(Inherited from BaseInPlaceFilter2.)
Top
Methods
  NameDescription
Public methodApply(Bitmap)
Apply filter to an image.
(Inherited from BaseInPlaceFilter.)
Public methodApply(BitmapData)
Apply filter to an image.
(Inherited from BaseInPlaceFilter.)
Public methodApply(UnmanagedImage)
Apply filter to an image in unmanaged memory.
(Inherited from BaseInPlaceFilter.)
Public methodApply(UnmanagedImage, UnmanagedImage)
Apply filter to an image in unmanaged memory.
(Inherited from BaseInPlaceFilter.)
Public methodApplyInPlace(Bitmap)
Apply filter to an image.
(Inherited from BaseInPlaceFilter.)
Public methodApplyInPlace(BitmapData)
Apply filter to an image.
(Inherited from BaseInPlaceFilter.)
Public methodApplyInPlace(UnmanagedImage)
Apply filter to an unmanaged image.
(Inherited from BaseInPlaceFilter.)
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodProcessFilter(UnmanagedImage)
Process the filter on the specified image.
(Inherited from BaseInPlaceFilter2.)
Protected methodProcessFilter(UnmanagedImage, UnmanagedImage)
Process the filter on the specified image.
(Overrides BaseInPlaceFilter2ProcessFilter(UnmanagedImage, UnmanagedImage).)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Extension Methods
  NameDescription
Public Extension MethodHasMethod
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)
Public Extension MethodIsEqual
Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices.
(Defined by Matrix.)
Public Extension MethodToT
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Top
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:

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

See Also