![]() |
Blend Class |
Namespace: Accord.Imaging.Filters
The Blend type exposes the following members.
Name | Description | |
---|---|---|
![]() | Blend(Bitmap) |
Constructs a new Blend filter.
|
![]() | Blend(Double, Bitmap) |
Constructs a new Blend filter.
|
![]() | Blend(MatrixH, Bitmap) |
Constructs a new Blend filter.
|
Name | Description | |
---|---|---|
![]() | AlphaOnly |
Gets or sets a value indicating whether only the alpha channel
should be blended. This can be used together with a transparency
mask to selectively blend only portions of the image.
|
![]() | FillColor |
Gets or sets the filling color used to fill blank spaces.
|
![]() | FormatTranslations |
Format translations dictionary.
(Overrides BaseTransformationFilterFormatTranslations.) |
![]() | Gradient |
Gets or sets a value indicating whether to blend using a linear
gradient or just superimpose the two images with equal weights.
|
![]() | Homography |
Gets or sets the Homography matrix used to map a image passed to
the filter to the overlay image specified at filter creation.
|
Name | Description | |
---|---|---|
![]() | Apply(Bitmap) |
Apply filter to an image.
(Inherited from BaseTransformationFilter.) |
![]() | Apply(BitmapData) |
Apply filter to an image.
(Inherited from BaseTransformationFilter.) |
![]() | Apply(UnmanagedImage) |
Apply filter to an image in unmanaged memory.
(Inherited from BaseTransformationFilter.) |
![]() | Apply(UnmanagedImage, UnmanagedImage) |
Apply filter to an image in unmanaged memory.
(Inherited from BaseTransformationFilter.) |
![]() | CalculateNewImageSize |
Computes the new image size.
(Overrides BaseTransformationFilterCalculateNewImageSize(UnmanagedImage).) |
![]() | Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Serves as the default hash function. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ProcessFilter |
Process the image filter.
(Overrides BaseTransformationFilterProcessFilter(UnmanagedImage, UnmanagedImage).) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
![]() | HasMethod |
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.) |
![]() | IsEqual |
Compares two objects for equality, performing an elementwise
comparison if the elements are vectors or matrices.
(Defined by Matrix.) |
![]() | To(Type) | Overloaded.
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.) |
![]() | ToT | Overloaded.
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.) |
The blending filter is able to blend two images using a homography matrix. A linear alpha gradient is used to smooth out differences between the two images, effectively blending them in two images. The gradient is computed considering the distance between the centers of the two images.
The first image should be passed at the moment of creation of the Blending filter as the overlay image. A second image may be projected on top of the overlay image by calling the Apply method and passing the second image as argument.
Currently the filter always produces 32bpp images, disregarding the format of source images. The alpha layer is used as an intermediate mask in the blending process.
// Let's start with two pictures that have been // taken from slightly different points of view: // Bitmap img1 = Resources.dc_left; Bitmap img2 = Resources.dc_right; // Those pictures are shown below: ImageBox.Show(img1, PictureBoxSizeMode.Zoom, 640, 480); ImageBox.Show(img2, PictureBoxSizeMode.Zoom, 640, 480);
// Step 1: Detect feature points using Surf Corners Detector var surf = new SpeededUpRobustFeaturesDetector(); var points1 = surf.ProcessImage(img1); var points2 = surf.ProcessImage(img2); // Step 2: Match feature points using a k-NN var matcher = new KNearestNeighborMatching(5); var matches = matcher.Match(points1, points2); // Step 3: Create the matrix using a robust estimator var ransac = new RansacHomographyEstimator(0.001, 0.99); MatrixH homographyMatrix = ransac.Estimate(matches); // Step 4: Project and blend using the homography Blend blend = new Blend(homographyMatrix, img1); // Compute the blending algorithm Bitmap result = blend.Apply(img2); // Show on screen ImageBox.Show(result, PictureBoxSizeMode.Zoom, 640, 480);
The resulting image is shown below.