https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Ugo Jardonnet <ugo.jardonnet(a)lrde.epita.fr>
Sandbox: ICP: Add commandline parameters q and e.
* sandbox/jardonnet/test/icp.cc: Read q and e on the command line.
* sandbox/jardonnet/registration/icp.hh: Add Fixme for Ck printing.
registration/icp.hh | 10 +++++++---
test/icp.cc | 13 ++++++++-----
2 files changed, 15 insertions(+), 8 deletions(-)
Index: sandbox/jardonnet/test/icp.cc
--- sandbox/jardonnet/test/icp.cc (revision 1856)
+++ sandbox/jardonnet/test/icp.cc (working copy)
@@ -9,16 +9,19 @@
void usage(char *argv[])
{
std::cout << "usage : " << argv[0]
- << " cloud.pbm surface.pbm" << std::endl;
+ << " cloud.pbm surface.pbm q e" << std::endl;
exit(1);
}
int main(int argc, char* argv[])
{
- if (argc != 3)
+ if (argc != 5)
usage(argv);
+ float q = std::atof(argv[3]);
+ int e = std::atoi(argv[4]);
+
using namespace mln;
typedef image3d< bool > I3d;
@@ -41,7 +44,7 @@
closest_point<mln_point_(I3d)> fun(x, box_<point3d>(1000,1000,1));
lazy_image< closest_point<mln_point_(I3d)> > map(fun);
- quat7<3> q = registration::icp(c, map, 2);
+ quat7<3> qk = registration::icp(c, map, q, e);
#ifndef NDEBUG
std::cout << "closest_point(Ck[i]) = " << fun.i <<
std::endl;
@@ -54,9 +57,9 @@
//FIXME: Should be
//mln_concrete(I) output(res.bbox()) = convert::to_image<I>(res)?
- q.apply_on(c, c, c.npoints());
+ qk.apply_on(c, c, c.npoints());
- const box_<point2d> box2d(1000,1000);
+ const box_<point2d> box2d(600,600);
image2d<bool> output(box2d, 1);
//to 2d : projection (FIXME:if 3d)
Index: sandbox/jardonnet/registration/icp.hh
--- sandbox/jardonnet/registration/icp.hh (revision 1856)
+++ sandbox/jardonnet/registration/icp.hh (working copy)
@@ -117,6 +117,7 @@
{
using namespace std;
+ //FIXME: Should use Ck box but Ck.bbox() is not correct for c_length
image2d<bool> img(box2d(500,800), 0);
for (size_t i = 0; i < c_length; i++)
{
@@ -125,6 +126,7 @@
img(p) = true;
}
+ //FIXME: Good but put point qfter c_length
//image2d<bool> img = convert::to_image2d(Ck);
stringstream oss;
static int pimp = 0;
@@ -156,6 +158,7 @@
quat7<P::dim>
icp(p_array<P> cloud,
M& map,
+ const float q,
const unsigned nb_it)
{
trace::entering("registration::icp");
@@ -177,10 +180,11 @@
quat7<P::dim> qk;
//run icp
- for (int i = nb_it; i >= 0; i--)
+ for (int e = nb_it-1; e >= 0; e--)
{
- size_t l = cloud.npoints() / std::pow(2., i); // 3 is arbitrary fixed
- impl::icp_(cloud, map, qk, l, i + 1e-3);
+ size_t l = cloud.npoints() / std::pow(q, e); // 3 is arbitrary fixed
+ l = (l<1) ? 1 : l;
+ impl::icp_(cloud, map, qk, l, e + 1e-1);
}
trace::exiting("registration::icp");