Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Color levels in OpenCV

I wanted to do similar function like Photoshop Levels ... There are three input values e.g. 0, 1.0, 255 and two output values 0, 255 which is in range from 0 to 255. The input is also range from 0 to 255 but they also have middle value (which should be gamma correction). You can apply this on one channel or on all three chanells.This is set by default as RGB (all channels). I have found this formulation

http://stackoverflow.com/questions/26912869/color-levels-in-opencv

by Dhanuska

and diagram:

levels

There is some formula but I don't know how implement this. It is not clear to me what are the y and x variables or how this works.

y = -150*(x-10)/240 + 200 for x [10, 250]

y = x for [0, 10) and (250, 255] if you want remaining values unchanged.

Can you gimme an implementation example in C++?

Color levels in OpenCV

I wanted to do similar function like Photoshop Levels ... There are three input values e.g. 0, 1.0, 255 and two output values 0, 255 which is in range from 0 to 255. The input is also range from 0 to 255 but they also have middle value (which should be gamma correction). You can apply this on one channel or on all three chanells.This is set by default as RGB (all channels). I have found this formulation

http://stackoverflow.com/questions/26912869/color-levels-in-opencv

by Dhanuska

and diagram:

levels

There is some formula but I don't know understand how to implement this. It is not clear to me what are the y and x variables or how this works.

y = -150*(x-10)/240 + 200 for x [10, 250]

y = x for [0, 10) and (250, 255] if you want remaining values unchanged.

Can you gimme an implementation example in C++?C++? I am having small icon as an image png and would like to test it.