/enhancer

A C++11 / GLSL library for enhancing photographs (adjusting brightness, contrast, etc.)

Primary LanguageC++MIT LicenseMIT

enhancer

macOS-Qt6 Ubuntu-Qt5 GitHub

A C++/GLSL library for enhancing photographs (adjusting brightness, contrast, etc.).

This repository contains the following three features:

  • GLSL shaders: Enhancement functionality as shaders for real-time enhancement applications.
  • C++ functions: Enhancement functionality as C++ functions for display-less environments.
  • Qt Widget: Utility Qt-based widget for easing the use of the GLSL shaders.

Supported Parameters

Default Set

  • Brightness:
    • Apply a gamma curve in the RGB space
  • Contrast:
    • Apply an S curve in the (gamma-corrected) RGB space
  • Saturation:
    • Scale the saturation
  • Temperature:
    • Add an offset toward the -U+V direction in the Y'UV space
  • Tint:
    • Add an offset toward the +U+V direction in the Y'UV space

Optional

  • Lift/Gamma/Gain (9D)
    • Reproduce common effects used in many color grading software packages
  • Color Balance (3D)
    • Adjust the RGB values while preserving the lightness

Examples

Brightness Brightness

Contrast Contrast

Saturation Saturation

Temperature Temperature

Tint Tint

Required Runtime Environments

  • GLSL 3.3
  • OpenGL 3.2 Core Profile (for Qt features only)

Dependencies

C++ Features

  • Eigen (for macOS users, brew install eigen; for Ubuntu18.04 users, apt-get install libeigen3-dev)

C++ Qt Features

  • Qt6 (for macOS users, brew install qt) or Qt5 (for Ubuntu 18.04 users, apt-get install qt5-default)

C++ API

Eigen::Vector3d enhance(const Eigen::Vector3d& input_rgb,
                        const Eigen::VectorXd& parameters);

where input_rgb is a 3-dimensional vector ([0, 1]^3), and parameters is a 5-dimensional vector ([0, 1]^5).

Projects using enhancer

Note: About Older Version (v1)

This library used to have a different procedure to enhance photographs, which was used for some previous publications [Koyama+UIST14; Koyama+CHI16; Koyama+SIGGRAPH17]. The original procedure has color_balance parameters (3D) instead of temperature and tint (2D). Thus, the total number of parameters was 6, not 5.

The color_balance parameters are for manipulating the chrominance of the input color, which is inherently 2D, and so assigning 3 parameters for this purpose is considered redundant. For example, color_balance = [0.5, 0.5, 0.5] and color_balance = [0.2, 0.2, 0.2] result in the same color even though the parameter sets are different.

Thus, the enhancement procedure was updated to use temperature and tint instead of color_balance. These two parameters are popularly used in Adobe Photoshop and Lightroom and so experts are likely to familiar with the concept. These two parameters also appeared in [Kapoor+IJCV14].