* contrast value should be in the rnage [-1,1] * */
| 18 | * contrast value should be in the rnage [-1,1] |
| 19 | * */ |
| 20 | array changeContrast(const array &in, const float contrast) { |
| 21 | float scale = tan((contrast + 1) * Pi / 4); |
| 22 | return (((in / 255.0f - 0.5f) * scale + 0.5f) * 255.0f); |
| 23 | } |
| 24 | |
| 25 | /** |
| 26 | * brightness value should be in the rnage [0,1] |