URL:
https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
ChangeLog:
2009-04-30 Fabien Freling <fabien.freling(a)lrde.epita.fr>
Update fixed segmentation, edges seems ok.
* fabien/igr/Makefile.rules: Update CXX to g++.
* fabien/igr/seg_fixed.cc: Update, edges appear to work.
---
Makefile.rules | 4 ++--
seg_fixed.cc | 41 +++++++++++++++++++++++------------------
2 files changed, 25 insertions(+), 20 deletions(-)
Index: trunk/milena/sandbox/fabien/igr/seg_fixed.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/seg_fixed.cc (revision 3735)
+++ trunk/milena/sandbox/fabien/igr/seg_fixed.cc (revision 3736)
@@ -56,16 +56,12 @@
template <typename I>
inline
float
-compute_dist(image2d<util::array<I> > ima_arr,
- image2d<float> ima_sum,
+compute_dist(image2d<util::array<I> >& ima_arr,
+ image2d<float>& ima_sum,
point2d p, point2d n)
{
float res = 0.f;
- std::cout << "computing..." << std::endl;
- std::cout << "ima_arr.bbox(): " << ima_arr.bbox() <<
std::endl;
- std::cout << "ima_arr(p).nelements(): " << ima_arr(p).nelements()
<< std::endl;
- std::cout << "ima_arr(n).nelements(): " << ima_arr(n).nelements()
<< std::endl;
for (unsigned i = 0; i < ima_arr(p).nelements(); ++i)
res += std::min(ima_arr(p)[i], ima_arr(n)[i]);
@@ -75,14 +71,15 @@
else
res = 0.f;
- //std::cout << "\t" << res << std::endl;
+ //std::cout << "dist: " << res << std::endl;
+
return res;
}
template <typename I>
inline
void
-compute_sum_arrays(image2d<float> ima_sum, image2d<util::array<I> >
ima_arr)
+compute_sum_arrays(image2d<float>& ima_sum, image2d<util::array<I>
>& ima_arr)
{
mln_piter(image2d<float>) p(ima_sum.domain());
for_all(p)
@@ -95,8 +92,9 @@
}
template <typename I>
+inline
image2d<float>
-dist_on_edges(image2d<util::array<I> > ima_arr)
+dist_on_edges(image2d<util::array<I> >& ima_arr)
{
box2d b = ima_arr.bbox();
image2d<float> edges(make::box2d(2 * b.pmin()[0], 2 * b.pmin()[1],
@@ -111,20 +109,16 @@
mln_niter(neighb2d) n(c4(), p);
for_all(p)
{
+ //std::cout << "can i has a loop?" << std::endl;
for_all(n)
{
point2d location = get_edge_location(p, n);
+ //std::cout << "p: " << p << " | n: "
<< n << " | location: " << location << std::endl;
if (b.has(n) && edge_b.has(location) && edges(location) == -1.f)
{
- std::cout << "p: " << p << " | n: " << n
<< " | e: " << location << std::endl;
- std::cout << "will compute..." << std::endl;
- float res = compute_dist(ima_arr, ima_sum, p, n);
- std::cout << "has computed" << std::endl << std::endl;
- std::cout << "\t" << res << std::endl;
- edges(location) = res;
+ //std::cout << "\\o/" << std::endl;
+ edges(location) = compute_dist(ima_arr, ima_sum, p, n);
}
- else
- std::cout << "." << std::endl;
}
}
@@ -162,8 +156,19 @@
// Edges computation.
image2d<float> edges = dist_on_edges(ima_arr);
+ /*mln_piter_(image2d<float>) p_iter(edges.domain());
+ for_all(p_iter)
+ {
+ std::cout << "<main> " << edges(p_iter);
+ if (p_iter.row() % 2 + p_iter.col() % 2 == 1)
+ std::cout << " OK";
+ std::cout << std::endl;
+ }*/
+
// Display.
- io::pgm::save(level::stretch(int_u8(), world::inter_pixel::display_edge(edges, 0.0,
3)), "edges.pgm");
+ image2d<float> display_ima = world::inter_pixel::display_edge(edges, 0.0, 3);
+ //std::cout << "display_ima box: " << display_ima.bbox() <<
std::endl;
+ io::pgm::save(level::stretch(int_u8(), display_ima), "edges.pgm");
return 0;
}
Index: trunk/milena/sandbox/fabien/igr/Makefile.rules
===================================================================
--- trunk/milena/sandbox/fabien/igr/Makefile.rules (revision 3735)
+++ trunk/milena/sandbox/fabien/igr/Makefile.rules (revision 3736)
@@ -1,5 +1,5 @@
-CXX = llvm-g++
-CXXFLAGS = -Wall -Wextra -DNDEBUG -O4
+CXX = g++
+CXXFLAGS = -Wall -Wextra -DNDEBUG -O3
DICOM_INC = -I/usr/local/include/gdcm-2.0
DICOM_LIBS = -lgdcmCommon -lgdcmDICT -lgdcmDSED -lgdcmIOD -lgdcmMSFF -lgdcmexpat
-lgdcmjpeg12 -lgdcmjpeg16 -lgdcmjpeg8 -lgdcmopenjpeg -lgdcmuuid -lgdcmzlib \