Giter Site home page Giter Site logo

shapefromshading-3's Introduction

Shape from shading

This work was part of a C++ school project. You can find the original handout (in french) in doc folder.

Introduction

The shape from shading (sfs) is a computer vision problem that involves rebuilding the relief of a scene from a single picture of it. The sfs was initiated in the 60s by the astronomer Rindfleish, with the publication of an article on the tomography of the moon. However,it was only in the 1970s with Horn and Brooks that sfs became a field of study in its own right. The authors focused on both the physical modeling of the problem, the uniqueness of the solution and the numerical methods of resolution. Their book still serves as a reference.

Modelization

In this project, we consider that the gray level of the image depends only on the direction of the incident light and the normal on the surface (Lambertian shading model):

with I the intensity of the shading (usually I โˆˆ [0; 255]), L the direction of incident light and n the outgoing unit normal. The main problem for the resolution is its nonlinearity which comes simply from the normalization of n. Assuming that the source is in (0,0,1) ("frontal" lighting) and the intensity being maximal when n and L are parallel, one can rewrite the equation, after normalization, as the eikonal equation (3).

Resolution

The (deterministic) optimization methods for sfs consist in minimizing functionalities representing the likelihood between the directional derivatives of a surface for the luminance equation. Two penalty terms are usually added. The first ensures the integrability of the solution, basic hypothesis of our modeling (Schwartz's condition on derivatives), the second penalizes non-smooth solutions. We discretise the previous functionalities by finite differences off-center on the righ. The challenge of this project was to implement in C++ the resolution of optimization problems (5) and (6) related to sfs using the L-BFGS algorithm. We also wrote an ImageFactory class to create images tests from analytical or discrete 3D surfaces.

Results

The project aimed at builind a full project in C++ therefore I did not focus on optimizing hyperparameters to get the best possible outcomes.

dragon dragon_mesh

Generate the binary using the makefile

make

Cleaning objects and binary

make clean

Run the program

./bin/app

Visualization of meshes

Using the Vizir software (made by Adrien Loseille) present in mesh folder

shapefromshading-3's People

Contributors

rfbr avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.