Commit 825a7819 authored by Edwin Carlinet's avatar Edwin Carlinet
Browse files

apps/misc: add compute_depth apps.

           *  apps/misc/CMakeLists.txt,
           *  apps/misc/compute_depth.cpp: New.
parent ea826a24
......@@ -3,4 +3,6 @@ link_libraries(${FreeImage_LIBRARIES})
add_executable(print_tos_stat print_tos_stat.cpp $<TARGET_OBJECTS:g2-tools>)
add_executable(reconstruct_from_tree reconstruct_from_tree.cpp)
add_executable(ppm_grain_filter_marginal ppm_grain_filter_marginal.cpp)
add_executable(psnr psnr.cpp)
\ No newline at end of file
add_executable(psnr psnr.cpp)
add_executable(compute_depth compute_depth.cpp)
#include <mln/core/image/image2d.hpp>
#include <mln/core/image/morphers/casted_image.hpp>
#include <mln/morpho/component_tree/io.hpp>
#include <mln/morpho/component_tree/compute_depth.hpp>
#include <mln/morpho/component_tree/reconstruction.hpp>
#include <mln/io/imsave.hpp>
int main(int argc, char** argv)
{
if (argc < 3) {
std::cerr << "Usage: " << argv[0] << " input.tree outdepth.tiff\n";
std::exit(1);
}
using namespace mln;
morpho::component_tree<unsigned, image2d<unsigned> > tree;
morpho::load(argv[1], tree);
auto dmap = morpho::compute_depth(tree);
image2d<unsigned> out;
resize(out, tree._get_data()->m_pmap);
morpho::reconstruction(tree, dmap, out);
io::imsave(imcast<uint16>(out), argv[2]);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment