Commit d92c9310 authored by Edwin Carlinet's avatar Edwin Carlinet
Browse files

Add missing cmake file for hierarchical segmentation tool and add

debugging outputs.

	*  apps/hierachical_seg-gui/CMakeLists.txt,
	*  apps/hierachical_seg-gui/hierachical_seg-gui.cpp: debug outputs.
parent 3d41c3f4
if (${QT4_FOUND})
INCLUDE(${QT_USE_FILE})
link_libraries(${FreeImage_LIBRARIES})
QT4_WRAP_CPP(hierarchical_seg-gui_MOC
${CMAKE_HOME_DIRECTORY}/mln/qt/imageviewer.hpp
brush.hpp)
QT4_GENERATE_MOC(${CMAKE_HOME_DIRECTORY}/mln/qt/imageviewer.hxx
${CMAKE_CURRENT_BINARY_DIR}/imageviewer.moc.cpp)
add_executable(hierarchical_seg-gui hierachical_seg-gui.cpp brush.cpp
${hierarchical_seg-gui_MOC}
${CMAKE_HOME_DIRECTORY}/mln/qt/qtimage.cpp
${CMAKE_CURRENT_BINARY_DIR}/imageviewer.moc.cpp)
add_executable(hierarchical_seg-cli hierachical_seg-cli.cpp)
target_link_libraries(hierarchical_seg-gui ${QT_QTMAIN_LIBRARY} ${QT_LIBRARIES})
endif(${QT4_FOUND})
#include <mln/core/image/image2d.hpp>
#include <mln/io/imread.hpp>
#include <mln/io/imsave.hpp>
#include <mln/core/colors.hpp>
#include <mln/colors/literal.hpp>
#include <mln/morpho/component_tree/component_tree.hpp>
#include <mln/morpho/component_tree/reconstruction.hpp>
#include <mln/morpho/maxtree/maxtree.hpp>
#include <mln/data/stretch.hpp>
......@@ -14,7 +16,6 @@
#include <apps/tos/topology.hpp>
#include <apps/tos/Kinterpolate.hpp>
#include "brush.hpp"
#include "myheap.hpp"
using namespace mln;
......@@ -49,11 +50,24 @@ segmentation(const tree_t& tree,
colortag v = (colortag)px.val();
if (K1::is_face_2(px.point()) and v != BLANC)
tags[x] = v;
{
if (tags[x] == BLANC)
tags[x] = v;
else if (tags[x] != v)
tags[x] = NOIR; // Ambuiguity => set background
}
}
tags[tree.get_root()] = NOIR; // Root is background
{
image2d<uint8> markers = imchvalue<uint8>(markers__);
morpho::reconstruction(tree, tags, markers);
io::imsave(markers, "/tmp/markers.tiff");
}
// Propagate up
mln_reverse_foreach(auto x, tree.nodes()) {
if (tags[x] != BLANC) {
......@@ -73,6 +87,12 @@ segmentation(const tree_t& tree,
tags[x] = tags[q];
}
{
image2d<uint8> markers = imchvalue<uint8>(markers__);
morpho::reconstruction(tree, tags, markers);
io::imsave(markers, "/tmp/markers2.tiff");
}
//
{
mln_pixter(pxin, pxout, f, out);
......
Supports Markdown
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