Richard Knop Richard Knop - 6 months ago 83
C++ Question

Adjusting contrast and brightness with OpenCV

So I am trying to increase both contrast and brightness with OpenCV a bit. This is what I am doing:

Mat image_copy;
cvtColor(image, image_copy, CV_BGRA2BGR);
image_copy.convertTo(image, -1, 1.3, 0.15);

Image I get though looks very strange. It has blue tint. Red and blue colours are inverted. So my red jumper is blue and a blue can on the table is red.


I am basically trying to achieve the same effect as when you set contrast to 30 and brightness to 15 here:


OpenCV has an entire page on the subject: Changing the contrast and brightness of an image!