https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
Index: ChangeLog
from Ugo Jardonnet <jardonnet(a)lrde.epita.fr>
Add functions on box : enlarge and bigger.
* jardonnet/registration/tools.hh (enlarge,bigger): Add.
* jardonnet/test/icp.cc: Update: use enlarge and bigger.
registration/tools.hh | 26 +++++++++++++++-----------
test/icp.cc | 12 +++++-------
2 files changed, 20 insertions(+), 18 deletions(-)
Index: jardonnet/registration/tools.hh
--- jardonnet/registration/tools.hh (revision 1957)
+++ jardonnet/registration/tools.hh (working copy)
@@ -147,15 +147,17 @@
template <typename P>
inline
- const box_<P>& //dif
+ box_<P> //dif
enlarge(const box_<P>& box, unsigned b)
{
+ box_<P> nbox(box);
+
for (unsigned i = 0; i < P::dim; ++i)
{
- box.pmin()[i] -= b;
- box.pmax()[i] += b;
+ nbox.pmin()[i] -= b;
+ nbox.pmax()[i] += b;
}
- return box;
+ return nbox;
}
template <typename P>
@@ -163,8 +165,11 @@
{
P pmin,pmax;
- pmin = min(a.pmin(), b.pmin());
- pmax = max(a.pmax(), b.pmax());
+ for (unsigned i = 0; i < P::dim; i++)
+ {
+ pmin[i] = (a.pmin()[i] < b.pmin()[i]) ? a.pmin()[i] : b.pmin()[i];
+ pmax[i] = (a.pmax()[i] > b.pmax()[i]) ? a.pmax()[i] : b.pmax()[i];
+ }
return box_<P>(pmin, pmax);
}
@@ -221,7 +226,7 @@
// to_pointNd
- //FIXME: Should we really provide this
+ //FIXME: Should be call projection
//point3d -> point2d
template <typename T>
inline
@@ -230,6 +235,7 @@
{
return point_<grid::square, T>(p[0], p[1]);
}
+
//point2d -> point2d
template <typename T>
inline
@@ -287,10 +293,8 @@
mln_piter(image3d<T>) p(img3d.domain());
for_all(p)
- {
- if (p[2] == 0)
img3d(p) = exact(img)(point2d(p[0],p[1]));
- }
+
return img3d;
}
@@ -299,6 +303,7 @@
namespace algebra
{
+ // transpose
template<unsigned n, unsigned m, typename T>
mat<m,n,T>
trans(const mat<n,m,T>& matrice)
@@ -311,7 +316,6 @@
}
// trace
-
template<unsigned n, typename T> inline
float tr(const mat<n,n,T>& m)
{
Index: jardonnet/test/icp.cc
--- jardonnet/test/icp.cc (revision 1957)
+++ jardonnet/test/icp.cc (working copy)
@@ -47,8 +47,11 @@
p_array<mln_point_(I3d)> c = convert::to_p_array(cloud);
p_array<mln_point_(I3d)> x = convert::to_p_array(surface);
+ //working box
+ const box_<mln_point_(I3d)> working_box =
enlarge(bigger(c.bbox(),x.bbox()),100);
+
//Make a lazy_image map via function closest_point
- closest_point<mln_point_(I3d)> fun(x, box_<point3d>(1000,1000,1));
+ closest_point<mln_point_(I3d)> fun(x, working_box);
lazy_image< closest_point<mln_point_(I3d)> > map(fun);
quat7<3> qk = registration::icp(c, map, q, e, x);
@@ -61,12 +64,7 @@
qk.apply_on(c, c, c.npoints());
//init output image
- //FIXME: Should be like
- //mln_concrete(I) output(res.bbox()) = convert::to_image<I>(res) ?
-
-
- const box_<point2d> box2d(400,700);
- image2d<value::rgb8> output(box2d, 1);
+ image2d<value::rgb8> output(convert::to_box2d(working_box), 1);
float stddev, mean;
registration::mean_stddev(c, map, mean, stddev);