Home Arithmetic and Bitwise Operation
Post
Cancel

Arithmetic and Bitwise Operation

What is Arithmetic Operation?

These are simple operations that allow us to directly add or subtract from the color intensity. They calculate the per-element operation of two arrays. The overall effect is increasing or decreasing the brightness. We can use Arithmetic Operation as: cv2.add(image, matrix).
You should avoid adding matrices like “image * matrix”.Doing so can result in unexpected values in the added image.



What is Bitwise Operation?

Bitwise Operation performs bit operation between two images. There is four kind of bitwise operator:

  • cv2.bitwise_and(image1, image2, dst, mask)
  • cv2.bitwise_or(image1, image2, dst, mask)
  • cv2.bitwise_xor(image1, image2, dst, mask)
  • cv2.bitwise_not(image1, image2, dst, mask)

parameters:

  • dst : output array that has the same size and type as input arrays.
  • mask : optional operation mask, an 8-bit single channel array, that specifies elements of the output array to be changed.





Implementation

Arithmetic and Bitwise Operations

This post is licensed under CC BY 4.0 by the author.