{"id":18449307,"url":"https://github.com/cnr-isti-vclab/relight","last_synced_at":"2025-10-24T03:43:24.557Z","repository":{"id":39498668,"uuid":"125239211","full_name":"cnr-isti-vclab/relight","owner":"cnr-isti-vclab","description":"A RTI library for creating and visualizing Reflectance Transformation Imaging","archived":false,"fork":false,"pushed_at":"2024-10-23T23:03:41.000Z","size":120062,"stargazers_count":70,"open_issues_count":24,"forks_count":13,"subscribers_count":20,"default_branch":"master","last_synced_at":"2024-10-24T12:24:19.654Z","etag":null,"topics":["html","image-processing","imaging","pca","ptm","webgl"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cnr-isti-vclab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-14T16:06:54.000Z","updated_at":"2024-10-21T15:39:27.000Z","dependencies_parsed_at":"2023-02-15T17:45:47.437Z","dependency_job_id":"bb88bf0a-60cc-46fc-b774-10574241c2ea","html_url":"https://github.com/cnr-isti-vclab/relight","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnr-isti-vclab%2Frelight","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnr-isti-vclab%2Frelight/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnr-isti-vclab%2Frelight/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnr-isti-vclab%2Frelight/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cnr-isti-vclab","download_url":"https://codeload.github.com/cnr-isti-vclab/relight/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247616360,"owners_count":20967377,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["html","image-processing","imaging","pca","ptm","webgl"],"created_at":"2024-11-06T07:19:32.549Z","updated_at":"2025-10-24T03:43:24.502Z","avatar_url":"https://github.com/cnr-isti-vclab.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n**Relight** is a library to create and view relightable images (RTI).\n\n## [Demo](https://vcg.isti.cnr.it/relight/)\n\n## Features\n\nRelight supports:\n\n* [Relight](#Relight fitter) a PCA based format (see paper)\n* [PTM, HSH](#PTM) \n* [Web viewer](#viewer)\n* [Zoomify, deepzoom, google, IIP, IIIF](#lod)\n\nRelight new formats provide better accuracy and smaller size.\n\n# Relight fitter\n\n*relight-cli* is a Qt command-line program to process a stack of photos into an RTI.\n\n\tUsage: relight-cli [-frqpsScCey]\u003cinput folder\u003e [output folder]\n\n\tinput folder containing a .lp with number of photos and light directions\n\toptional output folder (default is ./)\n\n\t-b \u003cbasis\u003e: rbf(default), ptm, lptm, hsh, yrbf, bilinear\n\t-p \u003cint\u003e  : number of planes (default: 9)\n\t-y \u003cint\u003e  : number of Y planes in YCC\n\t-r \u003cint\u003e  : side of the basis bilinear grid (default 8)\n\t-q \u003cint\u003e  : jpeg quality (default: 90)\n\t-s \u003cint\u003e  : sampling rate for pca (default 4)\n\t-S \u003cint\u003e  : sigma in rgf gaussian interpolation default 0.125 (~100 img)\n\t-C        : apply chroma subsampling \n\t-e        : evaluate reconstruction error (default: false)\n\n*relight-cli* can also be used to convert .ptm files into relight format:\n\n\trelight-cli [-q]\u003cfile.ptm\u003e [output folder]\n\t-q \u003cint\u003e  : jpeg quality (default: 90)\n\n\n# Relight web format\n\nRelight format is a directory containing an *info.json* file and a few images.\n\nJson contains the following fields:\n\n* width:\n* height:\n* format: image extension: .jpg, .png etc.\n* type: one of lptm, hsh, rbf, bilinear ycc\n* nplanes: number of coefficient planes\n* resolution: for bilinear types the side of the bilinear grid\n* colorspace: one of lrgb, rgb, ycc, mrgb, mycc\n* sigma: rbf interpolation parameter\n* lights: mandatory for rbf interpolation\n* materials: an array of materials, each material specify scale, bias and range\n* scale: an array of floating point values (float)\n* bias: an array of floating point values\n* range: an array of floating point values\n* basis: an array of unsigned chars containing the basis for rbf, bilinear and ycc basis.\n\nEach image contains 3 coefficient planes\n* PTM: r, g, b, 1, u, v, u^2, uv, v^2\n* HSH: see source code :)\n* RBF: PCA basis coefficients\n* BILINEAR: PCA basis coefficients\n* YCC: PCA basis coefficients as Y\u003csub\u003e0\u003c/sub\u003eC\u003csub\u003e0\u003c/sub\u003eC\u003csub\u003e0\u003c/sub\u003e, Y\u003csub\u003e1\u003c/sub\u003eC\u003csub\u003e1\u003c/sub\u003eC\u003csub\u003e1\u003c/sub\u003e... Y\u003csub\u003ek\u003c/sub\u003eC\u003csub\u003ek\u003c/sub\u003eC\u003csub\u003ek\u003c/sub\u003e, Y\u003csub\u003ek+1\u003c/sub\u003eY\u003csub\u003ek+2\u003c/sub\u003eY\u003csub\u003ek+3\u003c/sub\u003e\n\nScale and bias will be applied to the texture coefficients (from [0, 1]) as:\n\n\t(c - bias)*scale\n\n# Relight tiled web format\n\n*relight.js* support a variety of tiled formats\n\n* [Deepzoom](https://www.microsoft.com/silverlight/deep-zoom/)\n* [Zoomify](http://www.zoomify.com/)\n* [Google maps](https://developers.google.com/maps/)\n* [IIP](https://iipimage.sourceforge.io/)\n* [IIIF](http://iiif.io)\n\n[libvips](https://github.com/libvips/libvips/) can be used to [generate deepzoom, zoomify and google pyramidal formats](http://libvips.blogspot.com/2013/03/making-deepzoom-zoomify-and-google-maps.html), scripts can be found in the directory *test*.\n\n# Web Viewer\n\n*relight.min.js* is a small Javascript library to render the RTI on a WebGL canvas.\n\n\tvar relight = new Relight(canvas, options);\n\nOptions:\n* url: path to a directory containing the web format\n* layout: deepzoom, zoomify, google, iip, iiif or image for the web format\n* server: server URL for use with iip or iiif\n* stack: true or false - whether image is an image stack (IIP only)\n* light: initial light, array x, y, z.\n* pos: initial view object { x: y: z:}\n* border: for tiled formats amount of prefetching tiles arount the view (default 1)\n* fit: scale and center the view on load\n\n\nMembers:\n* pos: the position of the view as {x: y: z: t}\n where \n  x and y are the coords of the center of the screen in full scale image.\n  z is the zoom level with 0 being the original image.\n  t is for interpolation in ms\n* light: array of x, y, z light direction\n* onload: function to be called when rendering is ready\n\nMethods:\n* setUrl(url): change url\n* resize(width, height): resize canvas\n* zoom(amount, dt): \n* pan(dx, dy, dt): change the center of the view\n* setPosition(x, y, z, dt):\n* center(dt): center view (but does not change zoom\n* centerAndScale(dt): fit the view to the canvas\n* setLight(x, y, z): change light direction\n* draw(time): draw the canvas, use time for interpolation\n* redraw(): schedule an animaterequest\n\n## Building relight\n\n### Debian Linux\n\n```\n$ uname -a\nLinux x220 5.10.0-3-amd64 #1 SMP Debian 5.10.13-1 (2021-02-06) x86_64 GNU/Linux\n\n$ cat /etc/os-release \nPRETTY_NAME=\"Debian GNU/Linux bullseye/sid\"\nNAME=\"Debian GNU/Linux\"\nID=debian\nHOME_URL=\"https://www.debian.org/\"\nSUPPORT_URL=\"https://www.debian.org/support\"\nBUG_REPORT_URL=\"https://bugs.debian.org/\"\n```\n\nInstall dependencies. (replace libturbojpeg-dev with libjpeg62-turbo-devin for Ubuntu older than 2020)\n\n```shell\n$ apt update \u0026\u0026 apt install \\\n    build-essential \\\n    cmake \\\n    git \\\n    qt6-base-dev \\\n    libeigen3-dev \\\n    libturbojpeg6-dev \\\n    libomp-dev \\\n    libopencv-dev\n```\n\nClone this repository and build.\n\n```shell\n$ git clone https://github.com/cnr-isti-vclab/relight.git\n$ cd relight\n$ git submodule update --init --recursive\n$ cmake .\n$ make\n```\n\n### MacOS\n\nInstalled tools: \n* Homebrew, CMake, Qt6\n\nAdd homebrew binaries on your PATH: \n```shell\necho 'PATH=\"/opt/homebrew/bin:$PATH\"' \u003e\u003e ./zshrc\nsource ~/.zshrc\n```\n\nAdd some additional enviroment constants to your shell\n```shell\necho \"$(brew shellenv)\" \u003e\u003e ./zshrc\nsource ~/.zshrc\n```\n\nInstall dependencies: \n```shell\nbrew install jpeg-turbo coreutils llvm cmake ninja eigen \n```\n\nSet the Qt_DIR to point to your Qt6 installation and libomp path: \n```shell\nexport OPENMP_PATH=$(brew --prefix libomp)\nexport cmake -D OpenMP_ROOT=$OPENMP_PATH -D Qt6_DIR=/yourpath/Qt/version/macos/lib/cmake/Qt6\nmake\n```\n\n\n# TODO\n\n* White balance and other conversion from RAW features (dcraw)\n* use color tablet to calibrate raw images\n* contrast and other image processing\n* measure to be added to the images from tag\n* remove lens distortion\n* find spheres (very optional)\n* mask artifact\n* crop\n* join pieces\n* align images using mutual information (or better an edge detector?)\n* find highlight\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcnr-isti-vclab%2Frelight","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcnr-isti-vclab%2Frelight","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcnr-isti-vclab%2Frelight/lists"}