
https://svn.lrde.epita.fr/svn/oln/trunk/milena Index: ChangeLog from Ugo Jardonnet <jardonnet@lrde.epita.fr> Fix mln::registration::multiscale test. * tests/registration/Makefile.am: Add missing multiscale. * tests/registration/multiscale.cc: Add missing inclusion. * tests/registration/registration.cc: Use lena for tests (bof). * mln/registration/multiscale.hh: Fix wrong function call. * mln/registration/icp.hh: Fix documentation. mln/registration/icp.hh | 23 ++++++++++++++++------- mln/registration/multiscale.hh | 8 ++++---- tests/registration/Makefile.am | 4 +++- tests/registration/multiscale.cc | 2 +- tests/registration/registration.cc | 4 ++-- 5 files changed, 26 insertions(+), 15 deletions(-) Index: mln/registration/multiscale.hh --- mln/registration/multiscale.hh (revision 3206) +++ mln/registration/multiscale.hh (working copy) @@ -106,7 +106,7 @@ const unsigned nb_it) { p_array<mln_psite(I)> c = convert::to< p_array<mln_psite(I)> >(cloud); - p_array<mln_psite(J)> x = convert::to< p_array<mln_psite(I)> >(surface); + p_array<mln_psite(J)> x = convert::to< p_array<mln_psite(J)> >(surface); // Shuffle cloud shuffle(c); @@ -117,7 +117,7 @@ //make a lazy_image map via function closest_point fun::x2p::closest_point<mln_psite(I)> fun(x, working_box); - lazy_image<I, fun::x2p::closest_point<mln_psite(I)>, box2d > + const lazy_image<I, fun::x2p::closest_point<mln_psite(I)>, box2d > map(fun, fun.domain()); //init rigid transform qk @@ -126,9 +126,9 @@ //run registration for (int e = nb_it-1; e >= 0; e--) { - unsigned l = cloud.nsites() / std::pow(q, e); + unsigned int l = cloud.nsites() / std::pow(q, e); l = (l < 1) ? 1 : l; - registration::impl::icp_(cloud, l, map, qk, 1e-3); + icp_subset(c, l, map, qk); } return qk; } Index: mln/registration/icp.hh --- mln/registration/icp.hh (revision 3206) +++ mln/registration/icp.hh (working copy) @@ -101,17 +101,27 @@ icp(const p_array<P>& c, const M& map, const float epsilon = 1e-3); - /*! - * \fixme + + /*! Register point in \p c using a map of closest points \p map + * + * \param[in] c The cloud of points. + * \param[in] c_length points from cloud to use. + * \param[in] map The map of closest points. + * \param[in] qk The initial rigid transformation applied. + * \param[in] epsilon ICP stops if sqr_norm(qk - qk-1) / + * sqr_norm(qk) > epsilon + * \param[out] qk The rigid transformation obtained. + * + * \pre \p ima has to be initialized. */ template <typename P, typename M, typename T> inline void icp_subset(const p_array<P>& c, + const unsigned int c_length, const M& map, T& qk, - const unsigned c_length, - const float epsilon = 1e-3); + float epsilon = 1e-3); # ifndef MLN_INCLUDE_ONLY @@ -141,7 +151,6 @@ b[i] = f(convert::to< algebra::vec<P::dim,float> >(a[i])); } - template <typename P, typename M, typename T> inline void @@ -210,10 +219,10 @@ inline void icp_subset(const p_array<P>& c, - const unsigned c_length, + const unsigned int c_length, const M& map, T& qk, - const float epsilon = 1e-3) + float epsilon = 1e-3) { impl::icp_(c, c_length, map, qk, epsilon); } Index: tests/registration/multiscale.cc --- tests/registration/multiscale.cc (revision 3206) +++ tests/registration/multiscale.cc (working copy) @@ -30,8 +30,8 @@ * \brief Test on mln::registration::registration.cc */ +#include "tests/data.hh" #include <mln/io/pbm/all.hh> - #include <mln/registration/multiscale.hh> Index: tests/registration/registration.cc --- tests/registration/registration.cc (revision 3206) +++ tests/registration/registration.cc (working copy) @@ -42,8 +42,8 @@ image2d< bool > img2; //load images - io::pbm::load(img1, MLN_IMG_DIR "/tiny.pbm"); - io::pbm::load(img2, MLN_IMG_DIR "/tiny.pbm"); + io::pbm::load(img1, MLN_IMG_DIR "/lena.pbm"); + io::pbm::load(img2, MLN_IMG_DIR "/lena.pbm"); registration::registration(img1,img2); //FIXME: Auto test result Index: tests/registration/Makefile.am --- tests/registration/Makefile.am (revision 3206) +++ tests/registration/Makefile.am (working copy) @@ -3,8 +3,10 @@ include $(top_srcdir)/milena/tests/tests.mk check_PROGRAMS = \ - registration + registration \ + multiscale registration_SOURCES = registration.cc +multiscale_SOURCES = multiscale.cc TESTS = $(check_PROGRAMS)