
* apps/mesh-segm-skel/mesh-complex-pinv-curv-segm.cc, * apps/mesh-segm-skel/mesh-complex-pinv-curv-skel.cc: New. * apps/mesh-segm-skel/mesh-complex-max-curv-segm.cc, * apps/mesh-segm-skel/mesh-complex-max-curv-skel.cc: Remove dead code. * apps/mesh-segm-skel/test-mesh-complex-pinv-curv-segm.in, * apps/mesh-segm-skel/test-mesh-complex-pinv-curv-skel.in: New. * apps/mesh-segm-skel/Makefile.am (bin_PROGRAMS): Add mesh-complex-pinv-curv-segm and mesh-complex-pinv-curv-skel. (mesh_complex_pinv_curv_segm_SOURCES) (mesh_complex_pinv_curv_skel_SOURCES): New. (TESTS): Add test-mesh-complex-pinv-curv-segm and test-mesh-complex-pinv-curv-skel. (MOSTLYCLEANFILES): Add socket-complex-pinv-curv-segm.off, teapot-complex-pinv-curv-segm.off, socket-complex-pinv-curv-skel.off and teapot-complex-pinv-curv-skel.off. --- milena/ChangeLog | 25 ++++++++++++++++++++ milena/apps/mesh-segm-skel/Makefile.am | 20 ++++++++++++---- .../mesh-segm-skel/mesh-complex-max-curv-segm.cc | 19 ++++----------- .../mesh-segm-skel/mesh-complex-max-curv-skel.cc | 12 ++------- ...curv-segm.cc => mesh-complex-pinv-curv-segm.cc} | 20 ++++++--------- ...curv-skel.cc => mesh-complex-pinv-curv-skel.cc} | 23 ++++++++--------- ...segm.in => test-mesh-complex-pinv-curv-segm.in} | 9 ++++--- ...skel.in => test-mesh-complex-pinv-curv-skel.in} | 6 ++-- 8 files changed, 75 insertions(+), 59 deletions(-) copy milena/apps/mesh-segm-skel/{mesh-complex-max-curv-segm.cc => mesh-complex-pinv-curv-segm.cc} (91%) copy milena/apps/mesh-segm-skel/{mesh-complex-max-curv-skel.cc => mesh-complex-pinv-curv-skel.cc} (94%) copy milena/apps/mesh-segm-skel/{test-mesh-segm.in => test-mesh-complex-pinv-curv-segm.in} (65%) mode change 100755 => 100644 copy milena/apps/mesh-segm-skel/{test-mesh-complex-max-curv-skel.in => test-mesh-complex-pinv-curv-skel.in} (72%) diff --git a/milena/ChangeLog b/milena/ChangeLog index 1fe8399..3d8b6bc 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,3 +1,28 @@ +2010-07-15 Roland Levillain <roland@lrde.epita.fr> + + mesh-complex-pinv-curv-segm and mesh-complex-pinv-curv-skel apps. + + * apps/mesh-segm-skel/mesh-complex-pinv-curv-segm.cc, + * apps/mesh-segm-skel/mesh-complex-pinv-curv-skel.cc: + New. + * apps/mesh-segm-skel/mesh-complex-max-curv-segm.cc, + * apps/mesh-segm-skel/mesh-complex-max-curv-skel.cc: + Remove dead code. + * apps/mesh-segm-skel/test-mesh-complex-pinv-curv-segm.in, + * apps/mesh-segm-skel/test-mesh-complex-pinv-curv-skel.in: + New. + * apps/mesh-segm-skel/Makefile.am (bin_PROGRAMS): Add + mesh-complex-pinv-curv-segm and mesh-complex-pinv-curv-skel. + (mesh_complex_pinv_curv_segm_SOURCES) + (mesh_complex_pinv_curv_skel_SOURCES): + New. + (TESTS): Add test-mesh-complex-pinv-curv-segm and + test-mesh-complex-pinv-curv-skel. + (MOSTLYCLEANFILES): Add socket-complex-pinv-curv-segm.off, + teapot-complex-pinv-curv-segm.off, + socket-complex-pinv-curv-skel.off and + teapot-complex-pinv-curv-skel.off. + 2010-06-14 Roland Levillain <roland@lrde.epita.fr> Actually use the maximal curvature in mesh-complex-max-curv-segm. diff --git a/milena/apps/mesh-segm-skel/Makefile.am b/milena/apps/mesh-segm-skel/Makefile.am index 868c7d6..5dda5ec 100644 --- a/milena/apps/mesh-segm-skel/Makefile.am +++ b/milena/apps/mesh-segm-skel/Makefile.am @@ -171,9 +171,13 @@ MOSTLYCLEANFILES += \ socket-complex-max-curv-segm.off \ teapot-complex-max-curv-segm.off -# FIXME: Implement `mesh-complex-pinv-curv-segm' (factor as much -# code as possible with `mesh-complex-max-curv-segm'. -# ... +# Likewise, but using pseudo-inverse curvature. +bin_PROGRAMS += mesh-complex-pinv-curv-segm +mesh_complex_pinv_curv_segm_SOURCES = mesh-complex-pinv-curv-segm.cc +TESTS += test-mesh-complex-pinv-curv-segm +MOSTLYCLEANFILES += \ + socket-complex-pinv-curv-segm.off \ + teapot-complex-pinv-curv-segm.off ## Skeletonization. ## ---------------- @@ -187,8 +191,6 @@ MOSTLYCLEANFILES += \ teapot-max-curv.off \ three-triangles-skel.off -# FIXME: Implement `mesh-complex-{max,pinv}-curv-skel'. -# ... bin_PROGRAMS += mesh-complex-max-curv-skel mesh_complex_max_curv_skel_SOURCES = \ mesh-complex-max-curv-skel.cc save_bin_alt.hh @@ -196,3 +198,11 @@ TESTS += test-mesh-complex-max-curv-skel MOSTLYCLEANFILES += \ socket-complex-max-curv-skel.off \ teapot-complex-max-curv-skel.off + +bin_PROGRAMS += mesh-complex-pinv-curv-skel +mesh_complex_pinv_curv_skel_SOURCES = \ + mesh-complex-pinv-curv-skel.cc save_bin_alt.hh +TESTS += test-mesh-complex-pinv-curv-skel +MOSTLYCLEANFILES += \ + socket-complex-pinv-curv-skel.off \ + teapot-complex-pinv-curv-skel.off diff --git a/milena/apps/mesh-segm-skel/mesh-complex-max-curv-segm.cc b/milena/apps/mesh-segm-skel/mesh-complex-max-curv-segm.cc index a7a741a..aa55244 100644 --- a/milena/apps/mesh-segm-skel/mesh-complex-max-curv-segm.cc +++ b/milena/apps/mesh-segm-skel/mesh-complex-max-curv-segm.cc @@ -1,4 +1,5 @@ -// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2008, 2009, 2010 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of the Milena Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -30,6 +31,8 @@ /// surface of the (triangle) mesh of a statue, then performing a /// WST-based segmentation, using a complex-based image. +// Factor with mesh-complex-pinv-curv-segm.cc. + #include <cstdlib> #include <cmath> @@ -53,10 +56,6 @@ #include "trimesh/misc.hh" -// Doesn't C++ have a better way to express Pi? -static const float pi = 4 * atanf(1); - - int main(int argc, char* argv[]) { if (argc != 4) @@ -91,17 +90,9 @@ int main(int argc, char* argv[]) mln::p_n_faces_fwd_piter<D, G> v(float_ima.domain(), 0); for_all(v) { - // FIXME: The program should allow the user to choose the kind - // of measure (curvature). -#if 0 - float h = (curv.first(v) + curv.second(v)) / 2; - // Pseudo-inverse curvature. - float h_inv = 1 / pi * (atan(-h) + pi / 2); - float_ima(v) = h_inv; -#endif // Max curvature. float_ima(v) = mln::math::max(mln::math::sqr(curv.first(v)), - mln::math::sqr(curv.second(v))); + mln::math::sqr(curv.second(v))); } // Values on edges. diff --git a/milena/apps/mesh-segm-skel/mesh-complex-max-curv-skel.cc b/milena/apps/mesh-segm-skel/mesh-complex-max-curv-skel.cc index a174dd6..b910aae 100644 --- a/milena/apps/mesh-segm-skel/mesh-complex-max-curv-skel.cc +++ b/milena/apps/mesh-segm-skel/mesh-complex-max-curv-skel.cc @@ -29,9 +29,11 @@ /// \file apps/mesh-segm-skel/mesh-complex-max-curv-skel.cc /// \brief A program computing the maximal curvature values from the /// surface of the (triangle) mesh of a statue, then computing a -/// skeleton of this surface (by/ thinning), using a complex-based +/// skeleton of this surface (by thinning), using a complex-based /// image. +// FIXME: Factor with mesh-complex-pinv-curv-skel.cc. + #include <iostream> #include <mln/core/image/complex_image.hh> @@ -92,14 +94,6 @@ main(int argc, char* argv[]) mln::p_n_faces_fwd_piter<D, G> v(float_ima.domain(), 0); for_all(v) { - // FIXME: The program should allow the user to choose the kind - // of measure (curvature). -#if 0 - float h = (curv.first(v) + curv.second(v)) / 2; - // Pseudo-inverse curvature. - float h_inv = 1 / pi * (atan(-h) + pi / 2); - float_ima(v) = h_inv; -#endif // Max curvature. float_ima(v) = mln::math::max(mln::math::sqr(curv.first(v)), mln::math::sqr(curv.second(v))); diff --git a/milena/apps/mesh-segm-skel/mesh-complex-max-curv-segm.cc b/milena/apps/mesh-segm-skel/mesh-complex-pinv-curv-segm.cc similarity index 91% copy from milena/apps/mesh-segm-skel/mesh-complex-max-curv-segm.cc copy to milena/apps/mesh-segm-skel/mesh-complex-pinv-curv-segm.cc index a7a741a..fe7ee70 100644 --- a/milena/apps/mesh-segm-skel/mesh-complex-max-curv-segm.cc +++ b/milena/apps/mesh-segm-skel/mesh-complex-pinv-curv-segm.cc @@ -1,4 +1,5 @@ -// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2008, 2009, 2010 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of the Milena Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -25,10 +26,12 @@ // reasons why the executable file might be covered by the GNU General // Public License. -/// \file apps/mesh-segm-skel/mesh-complex-max-curv-segm.cc -/// \brief A program computing the maximal curvature values from the -/// surface of the (triangle) mesh of a statue, then performing a -/// WST-based segmentation, using a complex-based image. +/// \file apps/mesh-segm-skel/mesh-complex-pinv-curv-segm.cc +/// \brief A program computing the pseudo-inverse curvature values +/// from the surface of the (triangle) mesh of a statue, then +/// performing a WST-based segmentation, using a complex-based image. + +// Factor with mesh-complex-max-curv-segm.cc. #include <cstdlib> #include <cmath> @@ -91,17 +94,10 @@ int main(int argc, char* argv[]) mln::p_n_faces_fwd_piter<D, G> v(float_ima.domain(), 0); for_all(v) { - // FIXME: The program should allow the user to choose the kind - // of measure (curvature). -#if 0 float h = (curv.first(v) + curv.second(v)) / 2; // Pseudo-inverse curvature. float h_inv = 1 / pi * (atan(-h) + pi / 2); float_ima(v) = h_inv; -#endif - // Max curvature. - float_ima(v) = mln::math::max(mln::math::sqr(curv.first(v)), - mln::math::sqr(curv.second(v))); } // Values on edges. diff --git a/milena/apps/mesh-segm-skel/mesh-complex-max-curv-skel.cc b/milena/apps/mesh-segm-skel/mesh-complex-pinv-curv-skel.cc similarity index 94% copy from milena/apps/mesh-segm-skel/mesh-complex-max-curv-skel.cc copy to milena/apps/mesh-segm-skel/mesh-complex-pinv-curv-skel.cc index a174dd6..4a59a6b 100644 --- a/milena/apps/mesh-segm-skel/mesh-complex-max-curv-skel.cc +++ b/milena/apps/mesh-segm-skel/mesh-complex-pinv-curv-skel.cc @@ -26,11 +26,13 @@ // reasons why the executable file might be covered by the GNU General // Public License. -/// \file apps/mesh-segm-skel/mesh-complex-max-curv-skel.cc -/// \brief A program computing the maximal curvature values from the -/// surface of the (triangle) mesh of a statue, then computing a -/// skeleton of this surface (by/ thinning), using a complex-based -/// image. +/// \file apps/mesh-segm-skel/mesh-complex-pinv-curv-skel.cc +/// \brief A program computing the pseudo-inverse curvature values +/// from the surface of the (triangle) mesh of a statue, then +/// computing a skeleton of this surface (by thinning), using a +/// complex-based image. + +// FIXME: Factor with mesh-complex-max-curv-skel.cc. #include <iostream> @@ -57,6 +59,10 @@ #include "trimesh/misc.hh" +// Doesn't C++ have a better way to express Pi? +static const float pi = 4 * atanf(1); + + int main(int argc, char* argv[]) { @@ -92,17 +98,10 @@ main(int argc, char* argv[]) mln::p_n_faces_fwd_piter<D, G> v(float_ima.domain(), 0); for_all(v) { - // FIXME: The program should allow the user to choose the kind - // of measure (curvature). -#if 0 float h = (curv.first(v) + curv.second(v)) / 2; // Pseudo-inverse curvature. float h_inv = 1 / pi * (atan(-h) + pi / 2); float_ima(v) = h_inv; -#endif - // Max curvature. - float_ima(v) = mln::math::max(mln::math::sqr(curv.first(v)), - mln::math::sqr(curv.second(v))); } // Values on triangles. diff --git a/milena/apps/mesh-segm-skel/test-mesh-segm.in b/milena/apps/mesh-segm-skel/test-mesh-complex-pinv-curv-segm.in old mode 100755 new mode 100644 similarity index 65% copy from milena/apps/mesh-segm-skel/test-mesh-segm.in copy to milena/apps/mesh-segm-skel/test-mesh-complex-pinv-curv-segm.in index e70e63a..345aefd --- a/milena/apps/mesh-segm-skel/test-mesh-segm.in +++ b/milena/apps/mesh-segm-skel/test-mesh-complex-pinv-curv-segm.in @@ -1,6 +1,7 @@ #! /bin/sh -# Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE). +# Copyright (C) 2008, 2009, 2010 EPITA Research and Development +# Laboratory (LRDE). # # This file is part of Olena. # @@ -20,7 +21,7 @@ set -ex mesh_dir=@top_srcdir@/milena/mesh -time ./mesh-segm $mesh_dir/socket.off 25 socket-segm.off -time ./mesh-segm $mesh_dir/teapot.off 50 teapot-segm.off +time ./mesh-complex-pinv-curv-segm $mesh_dir/socket.off 25 socket-complex-pinv-curv-segm.off +time ./mesh-complex-pinv-curv-segm $mesh_dir/teapot.off 50 teapot-complex-pinv-curv-segm.off # FIXME: Too long. Should be run with (future) target `check-full'. -#time ./mesh-segm $mesh_dir/bunny-holefilled.off 500 bunny-holefilled-segm.off +#time ./mesh-complex-pinv-curv-segm $mesh_dir/bunny-holefilled.off 500 bunny-holefilled-complex-pinv-curv-segm.off diff --git a/milena/apps/mesh-segm-skel/test-mesh-complex-max-curv-skel.in b/milena/apps/mesh-segm-skel/test-mesh-complex-pinv-curv-skel.in similarity index 72% copy from milena/apps/mesh-segm-skel/test-mesh-complex-max-curv-skel.in copy to milena/apps/mesh-segm-skel/test-mesh-complex-pinv-curv-skel.in index ea7f604..0af2151 100644 --- a/milena/apps/mesh-segm-skel/test-mesh-complex-max-curv-skel.in +++ b/milena/apps/mesh-segm-skel/test-mesh-complex-pinv-curv-skel.in @@ -20,7 +20,7 @@ set -ex mesh_dir=@top_srcdir@/milena/mesh -time ./mesh-complex-max-curv-skel $mesh_dir/socket.off 10 socket-complex-max-curv-skel.off -time ./mesh-complex-max-curv-skel $mesh_dir/teapot.off 20 teapot-complex-max-curv-skel.off +time ./mesh-complex-pinv-curv-skel $mesh_dir/socket.off 10 socket-complex-pinv-curv-skel.off +time ./mesh-complex-pinv-curv-skel $mesh_dir/teapot.off 20 teapot-complex-pinv-curv-skel.off # FIXME: Too long. Should be run with (future) target `check-full'. -#time ./mesh-complex-max-curv-skel $mesh_dir/bunny-holefilled.off 50 bunny-holefilled-complex-max-curv-skel.off +time ./mesh-complex-pinv-curv-skel $mesh_dir/bunny-holefilled.off 50 bunny-holefilled-complex-pinv-curv-skel.off -- 1.5.6.5