cnr-isti-vclab / relight

A RTI library for creating and visualizing Reflectance Transformation Imaging
GNU General Public License v3.0
69 stars 13 forks source link
html image-processing imaging pca ptm webgl

Relight is a library to create and view relightable images (RTI).

Demo

Features

Relight supports:

Relight new formats provide better accuracy and smaller size.

Relight fitter

relight-cli is a Qt command-line program to process a stack of photos into an RTI.

Usage: relight-cli [-frqpsScCey]<input folder> [output folder]

input folder containing a .lp with number of photos and light directions
optional output folder (default is ./)

-b <basis>: rbf(default), ptm, lptm, hsh, yrbf, bilinear
-p <int>  : number of planes (default: 9)
-y <int>  : number of Y planes in YCC
-r <int>  : side of the basis bilinear grid (default 8)
-q <int>  : jpeg quality (default: 90)
-s <int>  : sampling rate for pca (default 4)
-S <int>  : sigma in rgf gaussian interpolation default 0.125 (~100 img)
-C        : apply chroma subsampling 
-e        : evaluate reconstruction error (default: false)

relight-cli can also be used to convert .ptm files into relight format:

relight-cli [-q]<file.ptm> [output folder]
-q <int>  : jpeg quality (default: 90)

Relight web format

Relight format is a directory containing an info.json file and a few images.

Json contains the following fields:

Each image contains 3 coefficient planes

Scale and bias will be applied to the texture coefficients (from [0, 1]) as:

(c - bias)*scale

Relight tiled web format

relight.js support a variety of tiled formats

libvips can be used to generate deepzoom, zoomify and google pyramidal formats, scripts can be found in the directory test.

Web Viewer

relight.min.js is a small Javascript library to render the RTI on a WebGL canvas.

var relight = new Relight(canvas, options);

Options:

Members:

Methods:

Building relight

Debian Linux

$ uname -a
Linux x220 5.10.0-3-amd64 #1 SMP Debian 5.10.13-1 (2021-02-06) x86_64 GNU/Linux

$ cat /etc/os-release 
PRETTY_NAME="Debian GNU/Linux bullseye/sid"
NAME="Debian GNU/Linux"
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Install dependencies. (replace libjpeg62-turbo0dev with libturbojpeg-dev in Ubuntu 2020)

$ apt update && apt install \
    build-essential \
    cmake \
    git \
    qtbase5-dev \
    libeigen3-dev \
    libjpeg62-turbo-dev \
    libomp-dev

Clone this repository and build.

$ git clone https://github.com/cnr-isti-vclab/relight.git
$ cd relight
$ git submodule update --init --recursive
$ cmake .
$ make

MacOS

Installed tools:

Add homebrew binaries on your PATH:

echo 'PATH="/opt/homebrew/bin:$PATH"' >> ./zshrc
source ~/.zshrc

Add some additional enviroment constants to your shell

echo "$(brew shellenv)" >> ./zshrc
source ~/.zshrc

Install dependencies:

brew install jpeg-turbo coreutils llvm cmake ninja eigen 

Set the Qt_DIR to point to your Qt6 installation and libomp path:

export OPENMP_PATH=$(brew --prefix libomp)
export cmake -D OpenMP_ROOT=$OPENMP_PATH -D Qt6_DIR=/yourpath/Qt/version/macos/lib/cmake/Qt6
make

TODO