![]() |
VOOZH | about |
Bitwise operations are used in image manipulation and used for extracting essential parts in the image. In this article, Bitwise operations used are :
Also, Bitwise operations helps in image masking. Image creation can be enabled with the help of these operations. These operations can be helpful in enhancing the properties of the input images.
NOTE: The Bitwise operations should be applied on input images of same dimensions.
Input Image 1:
👁 ImageInput Image 2:
👁 ImageBit-wise conjunction of input array elements.
Syntax: cv2.bitwise_and(source1, source2, destination, mask)
Parameters:
source1: First Input Image array(Single-channel, 8-bit or floating-point)
source2: Second Input Image array(Single-channel, 8-bit or floating-point)
dest: Output array (Similar to the dimensions and type of Input image array)
mask: Operation mask, Input / output 8-bit single-channel mask
Output:
Bit-wise disjunction of input array elements.
Syntax: cv2.bitwise_or(source1, source2, destination, mask)
Parameters:
source1: First Input Image array(Single-channel, 8-bit or floating-point)
source2: Second Input Image array(Single-channel, 8-bit or floating-point)
dest: Output array (Similar to the dimensions and type of Input image array)
mask: Operation mask, Input / output 8-bit single-channel mask
Output:
👁 ImageBit-wise exclusive-OR operation on input array elements.
Syntax: cv2.bitwise_xor(source1, source2, destination, mask)
Parameters:
source1: First Input Image array(Single-channel, 8-bit or floating-point)
source2: Second Input Image array(Single-channel, 8-bit or floating-point)
dest: Output array (Similar to the dimensions and type of Input image array)
mask: Operation mask, Input / output 8-bit single-channel mask
Output:
👁 ImageInversion of input array elements.
Syntax: cv2.bitwise_not(source, destination, mask)
Parameters:
source: Input Image array(Single-channel, 8-bit or floating-point)
dest: Output array (Similar to the dimensions and type of Input image array)
mask: Operation mask, Input / output 8-bit single-channel mask