Brightness is a comparative term that is determined by visual perception. Sometimes it is difficult to perceive the brightness. The value of pixel intensity can help us to find a brighter image. For example, if two pixels have the intensity values 110 and 230, then the latter one is brighter.
In OpenCV, adjusting image brightness is a very basic operation. Brightness can be controlled by changing the intensity of each pixel in an image:
# Import cv2 latest version of OpenCV library
import cv2
# Import matplotlib for showing the image
import matplotlib.pyplot as plt
# Magic function to render the figure in a notebook
%matplotlib inline
# Read image
image = cv2.imread('nature.jpeg')
# Convert image color space BGR to RGB
rgb_image=cv2.cvtColor(image,cv2.COLOR_BGR2RGB)
# Display the image
plt.imshow(rgb_image)
This results in the following output:
In the preceding code example, we have read the image and converted the BGR color model-based image into an RGB color...