Brightness means to change the value of each and every image pixel. This change can be done by either increasing or decreasing the pixel values of the image, by any constant. This article gives an in-depth knowledge about how can an image brightness be changed using OpenCV.
Input : Original Image Output : -> Original Image -> Image with brightness increased by 100 -> Image with brightness increased by 50 -> Image with brightness decreased by 100 -> Image with brightness decreased by 50
Code : CPP code to manipulate the image brightness
Brightness Level Increased by 50
Brightness Level Increased by 100
Brightness Level Decreased by 50
Brightness Level Decreased by 100
These code lines will change the image pixel values by a specified amount. The final changed image is then stored to the given output image. The brightness level will increase if the specified amount is positive (as above is 50), otherwise will decrease if the specified amount is negative.
MAT Function :
The “MAT” function changes each image pixel value to the target data type and the values are changed as per increase or decrease.
Parameters : m : Output Image rtype : Output Image type, Output Image type is same as input if it is set to -ve value alpha : Input image pixel are multiplied with this number prior to its assignment to output image beta : adding this value to each input image pixel
- OpenCV | Understanding Brightness in an Image
- OpenCV | Hands on Image Contrast
- Image Processing using OpenCV in Java | Set 13 (Brightness Enhancement)
- Image Inpainting using OpenCV
- OpenCV | Displaying an Image
- OpenCV | Saving an Image
- Image Pyramid using OpenCV | Python
- Image Processing without OpenCV | Python
- Image Registration using OpenCV | Python
- Cartooning an Image using OpenCV - Python
- Image Translation using OpenCV | Python
- Reading an image in OpenCV using Python
- Python | Image blurring using OpenCV
- OpenCV C++ Program to blur an image
- OpenCV | Understanding Contrast in an Image
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.