Copyright (c) 2004, Sylvain Paris and Francois Sillion All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of ARTIS, GRAVIR-IMAG nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This file contains code made by Sylvain Paris under supervision of François Sillion for his PhD work with ARTIS project. ARTIS is a research project in the GRAVIR/IMAG laboratory, a joint unit of CNRS, INPG, INRIA and UJF.
This file provides the graph implementation as first used in the ACCV'04 paper A Surface Reconstruction Method Using Global Graph Cut Optimization from Paris, Sillion and Quan. If you use this code, please let us know. We are interested in anything related to this work.
The code is in a "debug state": it is very verbose in case of error. Therefore it is clearly not as efficient as it could be.
To run this code, three other header files are required: array.h, geom.h and msg_stream.h
Source code can be downloaded from Sylvain Paris'page.
Here is an example of code:
#include "pushrelabel_non_linear_grid_3D.h" // ... typedef float real_type; typedef unsigned int size_type; typedef PushRelabel_non_linear_grid_3D<float> graph_type; const size_type x_size = 100; const size_type y_size = 200; const size_type z_size = 300; Array_3D<real_type> consistency(x_size,y_size,z_size); Array_3D<bool> domain(x_size,y_size,z_size); // ... // Some code determining the domain. // ... // Some code computing the consistency. // ... Array_2D<real_type> x_smoothness(x_size,y_size); Array_2D<real_type> y_smoothness(x_size,y_size); // ... // Some code computing the smoothness values. // ... graph_type graph(consistency,domain,x_smoothness,y_smoothness); graph.max_flow(); // This call takes most the computing time. Array_2D<size_type> cut; graph.min_cut(&cut); // Now, the 2D array contains the values of the cut i.e. z = cut(x,y).