Ask Your Question
0

Color levels in OpenCV

asked 2016-06-21 07:37:37 -0600

VanGog gravatar image

updated 2016-06-21 07:38:40 -0600

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/26...

by Dhanuska

and diagram:

levels

There is some formula but I don't 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++? I am having small icon as an image png and would like to test it.

edit retag flag offensive close merge delete

Comments

what have you tried? show us your code!

Balaji R gravatar imageBalaji R ( 2016-06-21 10:32:45 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-06-21 10:56:31 -0600

VanGog gravatar image

updated 2016-06-21 10:57:45 -0600

@Balaji R: I don't understand what is the x and y variables, what does this pseudo code do? Where is it applied - in which color space? Do I need to convert BGR to LUV,LAB or HSV to work with brightness? Is this code to correction of brightness? These are basic questions which I have and I cannot start any code until they are clear.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-06-21 07:37:37 -0600

Seen: 1,270 times

Last updated: Jun 21 '16