OpenCV  3.4.19
Open Source Computer Vision
Enumerations | Functions

Enumerations

enum  {
  cv::NORMAL_CLONE = 1,
  cv::MIXED_CLONE = 2,
  cv::MONOCHROME_TRANSFER = 3
}
 seamlessClone algorithm flags 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. More...
 
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. More...
 
void cv::seamlessClone (InputArray src, InputArray dst, InputArray mask, Point p, OutputArray blend, int flags)
 Image editing tasks concern either global changes (color/intensity corrections, filters, deformations) or local changes concerned to a selection. Here we are interested in achieving local changes, ones that are restricted to a region manually selected (ROI), in a seamless and effortless manner. The extent of the changes ranges from slight distortions to complete replacement by novel content [172] . More...
 
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. More...
 

Detailed Description

Useful links:

https://www.learnopencv.com/seamless-cloning-using-opencv-python-cpp

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

#include <opencv2/photo.hpp>

seamlessClone algorithm flags

Enumerator
NORMAL_CLONE 
Python: cv.NORMAL_CLONE

The power of the method is fully expressed when inserting objects with complex outlines into a new background

MIXED_CLONE 
Python: cv.MIXED_CLONE

The classic method, color-based selection and alpha masking might be time consuming and often leaves an undesirable halo. Seamless cloning, even averaged with the original image, is not effective. Mixed seamless cloning based on a loose selection proves effective.

MONOCHROME_TRANSFER 
Python: cv.MONOCHROME_TRANSFER

Monochrome transfer allows the user to easily replace certain features of one object by alternative features.

Function Documentation

◆ colorChange()

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.

Parameters
srcInput 8-bit 3-channel image.
maskInput 8-bit 1 or 3-channel image.
dstOutput image with the same size and type as src .
red_mulR-channel multiply factor.
green_mulG-channel multiply factor.
blue_mulB-channel multiply factor.

Multiplication factor is between .5 to 2.5.

Examples:
samples/cpp/tutorial_code/photo/seamless_cloning/cloning_demo.cpp.

◆ illuminationChange()

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.

Parameters
srcInput 8-bit 3-channel image.
maskInput 8-bit 1 or 3-channel image.
dstOutput image with the same size and type as src.
alphaValue ranges between 0-2.
betaValue ranges between 0-2.

This is useful to highlight under-exposed foreground objects or to reduce specular reflections.

Examples:
samples/cpp/tutorial_code/photo/seamless_cloning/cloning_demo.cpp.

◆ seamlessClone()

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>

Image editing tasks concern either global changes (color/intensity corrections, filters, deformations) or local changes concerned to a selection. Here we are interested in achieving local changes, ones that are restricted to a region manually selected (ROI), in a seamless and effortless manner. The extent of the changes ranges from slight distortions to complete replacement by novel content [172] .

Parameters
srcInput 8-bit 3-channel image.
dstInput 8-bit 3-channel image.
maskInput 8-bit 1 or 3-channel image.
pPoint in dst image where object is placed.
blendOutput image with the same size and type as dst.
flagsCloning method that could be cv::NORMAL_CLONE, cv::MIXED_CLONE or cv::MONOCHROME_TRANSFER
Examples:
samples/cpp/tutorial_code/photo/seamless_cloning/cloning_demo.cpp.

◆ textureFlattening()

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.

Parameters
srcInput 8-bit 3-channel image.
maskInput 8-bit 1 or 3-channel image.
dstOutput image with the same size and type as src.
low_thresholdRange from 0 to 100.
high_thresholdValue > 100.
kernel_sizeThe size of the Sobel kernel to be used.
Note
The algorithm assumes that the color of the source image is close to that of the destination. This assumption means that when the colors don't match, the source image color gets tinted toward the color of the destination image.
Examples:
samples/cpp/tutorial_code/photo/seamless_cloning/cloning_demo.cpp.