# How to decrease the Brightness of an image in OpenCV using C++?

OpenCVC++Server Side ProgrammingProgramming

The way of decreasing brightness is very similar to increasing brightness. The only difference is subtracting the 'Scalar (B, G, R)' from the image. Here, we are subtracting the scalar value to decrease the brightness.

The following program shows how to decrease the brightness of an image in OpenCV.

## Example

#include<iostream>
#include<opencv2/highgui/highgui.hpp>
using namespace cv;
using namespace std;
int main() {
Mat original; //Declaring a matrix to load the original image//
Mat dimmer;//Declaring a matrix to load the image after changing the brightness//
namedWindow("Original");//Declaring window to show the original image//
namedWindow("Dimmer");//Declaring window to show the brighter image//
}