Seamless CloningComputational Photography
Detailed Description
Useful links:
https://www.learnopencv.com/seamless-cloning-using-opencv-python-cpp
Enumerations | |
| enum | |
Useful links:
https://www.learnopencv.com/seamless-cloning-using-opencv-python-cpp
Enumerations | |
| enum | |
| cv::SeamlessCloneFlags { cv::NORMAL_CLONE = 1 , cv::MIXED_CLONE = 2 , cv::MONOCHROME_TRANSFER = 3 , cv::NORMAL_CLONE_WIDE = 9 , cv::MIXED_CLONE_WIDE = 10 , cv::MONOCHROME_TRANSFER_WIDE = 11 } |
| Flags for the seamlessClone algorithm. More... |
Functions | |
| void | cv::colorChange (InputArray src, InputArray mask, OutputArray dst, float red_mul=1.0f, float green_mul=1.0f, float blue_mul=1.0f) |
| Given an original color image, two differently colored versions of this image can be mixed seamlessly. | |
| void | cv::illuminationChange (InputArray src, InputArray mask, OutputArray dst, float alpha=0.2f, float beta=0.4f) |
| Applying an appropriate non-linear transformation to the gradient field inside the selection and then integrating back with a Poisson solver, modifies locally the apparent illumination of an image. | |
| void | cv::seamlessClone (InputArray src, InputArray dst, InputArray mask, Point p, OutputArray blend, int flags) |
| Performs seamless cloning to blend a region from a source image into a destination image. This function is designed for local image editing, allowing changes restricted to a region (manually selected as the ROI) to be applied effortlessly and seamlessly. These changes can range from slight distortions to complete replacement by novel content [221]. | |
| void | cv::textureFlattening (InputArray src, InputArray mask, OutputArray dst, float low_threshold=30, float high_threshold=45, int kernel_size=3) |
| By retaining only the gradients at edge locations, before integrating with the Poisson solver, one washes out the texture of the selected region, giving its contents a flat aspect. Here Canny Edge Detector is used. | |
#include <opencv2/photo.hpp>
Flags for the seamlessClone algorithm.
| Enumerator | |
|---|---|
| NORMAL_CLONE Python: cv.NORMAL_CLONE | Normal seamless cloning. This method is ideal for inserting objects with complex outlines into a new background. It preserves the original appearance and lighting of the inserted object, ensuring a natural blend. |
| MIXED_CLONE Python: cv.MIXED_CLONE | Mixed seamless cloning. This method addresses cases where simple color-based selection or alpha masking is time-consuming and may result in undesirable halos. By combining structure from the source and texture from the destination, mixed seamless cloning is highly effective, even with loosely defined selections. |
| MONOCHROME_TRANSFER Python: cv.MONOCHROME_TRANSFER | Monochrome transfer cloning. This method allows users to replace specific features of an object, such as grayscale textures or patterns, with alternative features. It is particularly useful for artistic effects or targeted object modifications. |
| NORMAL_CLONE_WIDE Python: cv.NORMAL_CLONE_WIDE | Enhanced normal seamless cloning. Similar to |
| MIXED_CLONE_WIDE Python: cv.MIXED_CLONE_WIDE | Enhanced mixed seamless cloning. Similar to |
| MONOCHROME_TRANSFER_WIDE Python: cv.MONOCHROME_TRANSFER_WIDE | Enhanced monochrome transfer cloning. Similar to |
| void cv::colorChange | ( | InputArray | src, |
| InputArray | mask, | ||
| OutputArray | dst, | ||
| float | red_mul = 1.0f, | ||
| float | green_mul = 1.0f, | ||
| float | blue_mul = 1.0f ) |
| Python: | ||||
|---|---|---|---|---|
| cv.colorChange( | src, mask[, dst[, red_mul[, green_mul[, blue_mul]]]] | ) -> | dst |
#include <opencv2/photo.hpp>
Given an original color image, two differently colored versions of this image can be mixed seamlessly.
| src | Input 8-bit 3-channel image. |
| mask | Input 8-bit 1 or 3-channel image. |
| dst | Output image with the same size and type as src . |
| red_mul | R-channel multiply factor. |
| green_mul | G-channel multiply factor. |
| void cv::illuminationChange | ( | InputArray | src, |
| InputArray | mask, | ||
| OutputArray | dst, | ||
| float | alpha = 0.2f, | ||
| float | beta = 0.4f ) |
| Python: | ||||
|---|---|---|---|---|
| cv.illuminationChange( | src, mask[, dst[, alpha[, beta]]] | ) -> | dst |
#include <opencv2/photo.hpp>
Applying an appropriate non-linear transformation to the gradient field inside the selection and then integrating back with a Poisson solver, modifies locally the apparent illumination of an image.
| src | Input 8-bit 3-channel image. |
| mask | Input 8-bit 1 or 3-channel image. |
| dst | Output image with the same size and type as src. |
| alpha | Value ranges between 0-2. |
| beta | Value ranges between 0-2. |
| void cv::seamlessClone | ( | InputArray | src, |
| InputArray | dst, | ||
| InputArray | mask, | ||
| Point | p, | ||
| OutputArray | blend, | ||
| int | flags ) |
| Python: | ||||
|---|---|---|---|---|
| cv.seamlessClone( | src, dst, mask, p, flags[, blend] | ) -> | blend |
#include <opencv2/photo.hpp>
Performs seamless cloning to blend a region from a source image into a destination image. This function is designed for local image editing, allowing changes restricted to a region (manually selected as the ROI) to be applied effortlessly and seamlessly. These changes can range from slight distortions to complete replacement by novel content [221].
| src | The source image (8-bit 3-channel), from which a region will be blended into the destination. |
| dst | The destination image (8-bit 3-channel), where the src image will be blended. |
| mask | A binary mask (8-bit, 1, 3, or 4-channel) specifying the region in the source image to blend. Non-zero pixels indicate the region to be blended. If an empty Mat is provided, a mask with all non-zero pixels is created internally. |
| void cv::textureFlattening | ( | InputArray | src, |
| InputArray | mask, | ||
| OutputArray | dst, | ||
| float | low_threshold = 30, | ||
| float | high_threshold = 45, | ||
| int | kernel_size = 3 ) |
| Python: | ||||
|---|---|---|---|---|
| cv.textureFlattening( | src, mask[, dst[, low_threshold[, high_threshold[, kernel_size]]]] | ) -> | dst |
#include <opencv2/photo.hpp>
By retaining only the gradients at edge locations, before integrating with the Poisson solver, one washes out the texture of the selected region, giving its contents a flat aspect. Here Canny Edge Detector is used.
| src | Input 8-bit 3-channel image. |
| mask | Input 8-bit 1 or 3-channel image. |
| dst | Output image with the same size and type as src. |
| low_threshold | Range from 0 to 100. |
| high_threshold | Value > 100. |
| blue_mul | B-channel multiply factor. |
Multiplication factor is between .5 to 2.5.
This is useful to highlight under-exposed foreground objects or to reduce specular reflections.
| p | The point where the center of the src image is placed in the dst image. |
| blend | The output image that stores the result of the seamless cloning. It has the same size and type as dst. |
| flags | Flags that control the type of cloning method, can take values of cv::SeamlessCloneFlags. |
| kernel_size | The size of the Sobel kernel to be used. |