开发者

Programming GIMP's Curves Tool

开发者 https://www.devze.com 2023-02-07 06:04 出处:网络
I am taking a look at GIMP\'s Curves Tool, and is wondering the procedure behind this great tool. I grab GIMP\'s source code, and tries to understand it. But I realized, without proper knowledge, this

I am taking a look at GIMP's Curves Tool, and is wondering the procedure behind this great tool. I grab GIMP's source code, and tries to understand it. But I realized, without proper knowledge, this is rather difficult.

This isn't a simple brightness/contrast adju开发者_开发百科stment. So I need some help in the theory and implementation detail of the Curves Tool. It's called the "Curves Tool", but image processing-wise, does it have an alternative name? (So I can Google)

All I care is how does the tool works after given all the required values. In other words, how does it alter the image's histogram. I want to know the implementation details of such tool.


The curves tool is all about mapping the values (intensities) of the R, G and B (and alpha) channels in each pixel in the image. The X axis is the input intensity of a channel in [0,255] and the Y axis the output intensity in [0,255].

This is a general tool for doing, for example, brightness (a straight line going from anywhere on the Y axis on the left to the top right corner), contrast (an "s shape" graph), gamma (a power function, something like x^gamma) or colour balance (a straight line going from the bottom left to anywhere on the axis y = 255 or the axis x = 255).

The function you define is then applied to each pixel's R, G and B (and alpha) channels. The histogram is just a summary of the colour distribution in your image before applying the curve you have defined.


Think of the histogram as a set of "bins" along the horizontal axis of the graph. The "curve" defines a multiplier for each of those bins. A straight line starting from the bottom left corner and extending to the top-right corner defines a multiplier of 1.0. For each bin, you calculate the percentage deviation between that straight line and the actual position of the curve and multiply the value in that bin by that value.

0

精彩评论

暂无评论...
验证码 换一张
取 消