Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://github.com/seanbell/intrinsic
06 April 2024, 02:58:27 UTC
  • Code
  • Branches (1)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/master
    No releases to show
  • d587ee6
  • /
  • README.md
Raw File Download Save again
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge
swh:1:cnt:662b9c99a66068caad34b2aa87c0124a07270692
origin badgedirectory badge
swh:1:dir:d587ee6779413a3c475a5ff6b8263c1e9f769acd
origin badgerevision badge
swh:1:rev:698b1e0fd23c216bb65164927c4de85b2c94b1af
origin badgesnapshot badge
swh:1:snp:cfaceec4dff818b4859c50fb4329f415ac4dcfbf

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
Tip revision: 698b1e0fd23c216bb65164927c4de85b2c94b1af authored by Sean Bell on 18 July 2014, 20:45:42 UTC
adding __init___.py
Tip revision: 698b1e0
README.md
Intrinsic Images in the Wild
============================

This repository contains the decomposition algorithm presented in our
[paper](http://intrinsic.cs.cornell.edu):

	Sean Bell, Kavita Bala, Noah Snavely
	"Intrinsic Images in the Wild"
	ACM Transactions on Graphics (SIGGRAPH 2014)

	@article{bell14intrinsic,
		author = "Sean Bell and Kavita Bala and Noah Snavely",
		title = "Intrinsic Images in the Wild",
		journal = "ACM Trans. on Graphics (SIGGRAPH)",
		volume = "33",
		number = "4",
		year = "2014",
	}

as well as a simple Python wrapper to the C++ dense CRF inference code from
[Krahenbuhl et al 2013](http://graphics.stanford.edu/projects/drf/):

	Philipp Krähenbühl and Vladlen Koltun
    "Parameter Learning and Convergent Inference for Dense Random Fields"
    International Conference on Machine Learning (ICML) 2013

It's nice to see how many people are using our code, so please "star" our
repository on Github.

The dataset is hosted at http://intrinsic.cs.cornell.edu/.


Dependencies
------------

The following libraries are needed:

- Eigen (http://eigen.tuxfamily.org/)
  On Ubuntu, you can install with: `sudo apt-get install libeigen3-dev`

- Python 2.7

- Python packages (newer packages will likely work, though these are the exact
  versions that I used):

      PIL==1.1.7
      cython==0.19.2
      numpy==1.8.0
      scipy==0.13.2
      scikit-image==0.9.3
      scikit-learn==0.14.1


Compile
-------

If on Ubuntu and you have installed Eigen3 to its default directory (/usr/include/eigen3),
then you can build the C++ extension with:

    cd krahenbuhl2013/
    make

If you are on another operating system or `eigen3` is in another directory,
edit `krahenbuhl2013/setup.py` to change the directory.


Running
-------

Basic usage:

    bell2014/decompose.py image.png

All arguments:

    usage: decompose.py [-h] [-r <file>] [-s <file>] [-m <file>] [-j <file>]
                        [-p <file>] [-l] [-q] [--show-labels]
                        <file>

    Decompose an image using the algorithm presented in: Sean Bell, Kavita Bala,
    Noah Snavely. "Intrinsic Images in the Wild". ACM Transactions on Graphics
    (SIGGRAPH 2014). http://intrinsic.cs.cornell.edu. The output is rescaled for
    viewing and encoded as sRGB PNG images(unless --linear is specified).

    positional arguments:
      <file>                Input image

    optional arguments:
      -h, --help            show this help message and exit
      -r <file>, --reflectance <file>
                            Reflectance layer output name (saved as sRGB image)
      -s <file>, --shading <file>
                            Shading layer output name (saved as sRGB image)
      -m <file>, --mask <file>
                            Mask filename
      -j <file>, --judgements <file>
                            Judgements file from the Intrinsic Images in the Wild
                            dataset
      -p <file>, --parameters <file>
                            Parameters file (JSON format). See bell2014/params.py
                            for a list of parameters.
      -l, --linear          if specified, assume input is linear and generate
                            linear output, otherwise assume input is sRGB and
                            generate sRGB output
      -q, --quiet           if specified, don't print logging info
      --show-labels         if specified, also output labels


Tone-mapping
------------

All input images are assumed to be sRGB, and the output reflectance and shading
layers are tone-mapped to sRGB.  If using linear images (e.g., the MIT
Intrinsic Images Dataset, http://www.cs.toronto.edu/~rgrosse/intrinsic/),
specify `--linear` and both input/output will remain linear.


Embedding in other projects
---------------------------

Our code was written to be modular and can be embedded in larger projects.
The basic code for constructing the input and parameters can be found in
`bell2014/decompose.py` or is listed below:

```python
from bell2014.solver import IntrinsicSolver
from bell2014.input import IntrinsicInput
from bell2014.params import IntrinsicParameters
from bell2014 import image_util

input = IntrinsicInput.from_file(
	image_filename,
	image_is_srgb=sRGB,
	mask_filename=mask_filename,
	judgements_filename=judgements_filename,
)

params = IntrinsicParameters.from_dict({
	'param1': ...,
	'param2': ...,
})

solver = IntrinsicSolver(input,params)
r, s, decomposition = solver.solve()

image_util.save(r_filename, r, mask_nz=input.mask_nz, rescale=True)
image_util.save(s_filename, s, mask_nz=input.mask_nz, rescale=True)
```

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API