Decreasing contrast
Here, we are decreasing the contrast values by a factor of 0.5 and to do so 0.5 is multiplied to each and every image pixel in the input image but the only thing important is that the value of any pixel should not go below the minimum allowed pixel.
As here in our output image, the contrast is decreased by a factor of 0.5.
OpenCV | Understanding Contrast in an Image
In OpenCV, changing the contrast of an image is a very basic task to perform. By changing the image contrast, it is meant to change the value of each and every image pixel. This change can be done by either multiplying or dividing (means to multiply each pixel with value < 1) the pixel values of the image, by any constant.
To increase the contrast levels of the image, simply multiply a constant positive value to each and every image pixel.
Similarly if one wishes to decrease the contrast level of the image, then multiply a constant positive value less than 1 for each and every image pixel.
Let’s take an assumption by considering the below-mentioned matrix as our image matrix with values of pixel ranging from 0 to 255 and let’s assume that the data type for this image is CV_8UC3.
Contact Us