
Figure 3-1: The face of a child is alpha blended onto the face of a cat
cv::bitwise_and()
void cv::bitwise_and(
cv::InputArray src1, // First input array
cv::InputArray src2, // Second input array
cv::OutputArray dst, // Result array
cv::InputArray mask = cv::noArray(), // Optional mask, compute only where nonzero
)
cv::bitwise_and() is a per-element bitwise conjunction operation. For every element in src1, the
bitwise AND is computed with the corresponding element in src2 and put into the corresponding element
of dst.
If you are not using a mask, the same result can be achieved with the matrix operation:
dst = src1 & src2;
cv::bitwise_not()
void cv::bitwise_not(
cv::InputArray src, // Input array
cv::OutputArray dst, // Result array
cv::InputArray mask = cv::noArray(), // Optional mask, compute only where nonzero
)
cv::bitwise_not() is a per-element bitwise inversion operation. For every element in src1 the
logical inversion is computed and placed into the corresponding element of dst.
If you are not using a mask, the same result can be achieved with the matrix operation:
dst = !src1;