Ask Your Question
0

Color curve operation with OpenCV: Increase contrast

asked 2013-12-16 10:32:38 -0600

Linke Seitentasche gravatar image

updated 2013-12-16 10:51:34 -0600

Hi

With the Gimp image manipulation program, I frequently increase contrast by using the color curve tool. From this:

image description

to this:

image description

There is a small tutorial that talks about increasing contrast here: http://docs.opencv.org/doc/tutorials/core/basic_linear_transform/basic_linear_transform.html

Therefore, I assume this operation would give the desired effect:

image.convertTo(alpha: 1.3, beta: -20)

I would have to calculate the exact alpha and beta values in order to exactly represent the above color curve. Maybe anybody can comment on these assumptions or has suggestions?

Thank you very much.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-12-22 16:08:06 -0600

Linke Seitentasche gravatar image

updated 2013-12-24 09:34:39 -0600

The following code calculates the appropriate measures:

    int xdist = indentRight - indentLeft; // indent as index from 0 to 256, for the above picture: indentRight: 235, indentLeft: 15
    double alpha = 256.0 / xdist;
    int beta = (int) -(indentLeft* alpha);
edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-12-16 10:32:38 -0600

Seen: 2,884 times

Last updated: Dec 24 '13