https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Ugo Jardonnet <ugo.jardonnet(a)lrde.epita.fr>
Sandbox: ICP: ck point to xk point distance.
* sandbox/jardonnet/test/icp.cc: Ck point color depends on the distance
with its closest point.
* sandbox/jardonnet/test/length.ppm: Result image.
* sandbox/jardonnet/TODO: Update.
* sandbox/jardonnet/registration/quat7.hh: Minor fix.
* sandbox/jardonnet/registration/icp.hh: Minor fix.
mln/core/dpoint.hh | 1
sandbox/jardonnet/TODO | 2 +
sandbox/jardonnet/registration/quat7.hh | 2 -
sandbox/jardonnet/test/icp.cc | 37 +++++++++++++++++++++++++++++---
4 files changed, 36 insertions(+), 6 deletions(-)
Index: mln/core/dpoint.hh
--- mln/core/dpoint.hh (revision 1888)
+++ mln/core/dpoint.hh (working copy)
@@ -39,7 +39,6 @@
# include <mln/algebra/vec.hh>
# include <mln/metal/converts_to.hh>
-
namespace mln
{
Index: sandbox/jardonnet/test/icp.cc
--- sandbox/jardonnet/test/icp.cc (revision 1888)
+++ sandbox/jardonnet/test/icp.cc (working copy)
@@ -2,6 +2,8 @@
#include <mln/io/pbm/load.hh>
#include <mln/io/pbm/save.hh>
+#include <mln/io/ppm/save.hh>
+#include <mln/norm/l2.hh>
#include <sandbox/jardonnet/registration/icp.hh>
#include <sandbox/jardonnet/registration/tools.hh>
@@ -64,17 +66,46 @@
qk.apply_on(c, c, c.npoints());
const box_<point2d> box2d(400,700);
- image2d<bool> output(box2d, 1);
+ image2d<value::rgb8> output(box2d, 1);
+
+
+
+ std::vector<float> length(c.npoints());
+ //mean + length
+ float mean = 0;
+ for (size_t i = 0; i < c.npoints(); i++)
+ {
+ float f = norm::l2(algebra::vec<3,int> (c[i] - map(c[i])));;
+ length[i] = f;
+ mean += f;
+ }
+ mean /= c.npoints();
+ std::cout << mean << std::endl;
+
+ //standar variation
+ float stdev = 0;
+ for (size_t i = 0; i < c.npoints(); i++)
+ stdev += (length[i] - mean) * (length[i] - mean);
+ stdev /= c.npoints();
+ stdev = math::sqrt(stdev);
+ std::cout << stdev << std::endl;
//to 2d : projection (FIXME:if 3d)
for (size_t i = 0; i < c.npoints(); i++)
{
point2d p(c[i][0], c[i][1]);
if (output.has(p))
- output(p) = true;
+ {
+ if (length[i] > 2 * stdev)
+ output(p) = value::rgb8(255,0,0);
+ else if (length[i] > stdev)
+ output(p) = value::rgb8(255,200,0);
+ else
+ output(p) = value::rgb8(255,255,255);
+ }
}
- io::pbm::save(output, "registred.pbm");
+ io::ppm::save(output, "registred.ppm");
}
Index: sandbox/jardonnet/test/length.ppm
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: sandbox/jardonnet/test/length.ppm
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Index: sandbox/jardonnet/TODO
--- sandbox/jardonnet/TODO (revision 1888)
+++ sandbox/jardonnet/TODO (working copy)
@@ -19,3 +19,5 @@
trans : vec --> quat
v |-> m = trans(t)
+- -
+io/all.hh cass�
\ No newline at end of file
Index: sandbox/jardonnet/registration/quat7.hh
--- sandbox/jardonnet/registration/quat7.hh (revision 1888)
+++ sandbox/jardonnet/registration/quat7.hh (working copy)
@@ -129,8 +129,6 @@
M& map,
size_t c_length)
{
- //FIXME: mix mu_Xk and qk loop
-
//mu_Xk = center map(Ck)
algebra::vec<P::dim,float> mu_Xk(literal::zero);
for (size_t i = 0; i < c_length; ++i)
Index: sandbox/jardonnet/registration/icp.hh