
* lazzara/irm/hsl_grad_and_wst.cc, * lazzara/irm/irm_seg_with_mm_and_rag.cc, * lazzara/irm/wst_rag.cc, * lazzara/irm/wst_rag_hsl.cc: revamp and make use of make::graph. --- milena/sandbox/ChangeLog | 10 ++ milena/sandbox/lazzara/irm/hsl_grad_and_wst.cc | 79 +++++++-- .../sandbox/lazzara/irm/irm_seg_with_mm_and_rag.cc | 93 +++++++++++ milena/sandbox/lazzara/irm/wst_rag.cc | 100 +++--------- milena/sandbox/lazzara/irm/wst_rag_hsl.cc | 170 ++++++++------------ 5 files changed, 262 insertions(+), 190 deletions(-) create mode 100644 milena/sandbox/lazzara/irm/irm_seg_with_mm_and_rag.cc diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog index ec838b2..79e7d3c 100644 --- a/milena/sandbox/ChangeLog +++ b/milena/sandbox/ChangeLog @@ -1,3 +1,13 @@ +2009-02-16 Guillaume Lazzara <z@lrde.epita.fr> + + Update Igr's code. + + * lazzara/irm/hsl_grad_and_wst.cc, + * lazzara/irm/irm_seg_with_mm_and_rag.cc, + * lazzara/irm/wst_rag.cc, + * lazzara/irm/wst_rag_hsl.cc: revamp and make use of make::graph. + + 2009-02-13 Thierry Geraud <thierry.geraud@lrde.epita.fr> Finalize ICIP 2009 code. diff --git a/milena/sandbox/lazzara/irm/hsl_grad_and_wst.cc b/milena/sandbox/lazzara/irm/hsl_grad_and_wst.cc index f7b0335..ac29dd6 100644 --- a/milena/sandbox/lazzara/irm/hsl_grad_and_wst.cc +++ b/milena/sandbox/lazzara/irm/hsl_grad_and_wst.cc @@ -1,18 +1,22 @@ #include <mln/essential/2d.hh> -#include <mln/value/hsl.hh> + #include <mln/core/image/violent_cast_image.hh> + #include <mln/extract/all.hh> + #include <mln/value/label_16.hh> #include <mln/value/int_u8.hh> +#include <mln/value/hsl.hh> + #include <mln/morpho/closing_area.hh> +#include <mln/morpho/closing_volume.hh> + #include <mln/io/dump/save.hh> +#include <mln/io/ppm/all.hh> -mln::value::int_u8 foo(unsigned u) -{ - return u == 0 ? - 0 : // wshed line - 1 + (u - 1) % 255; // basin -} +#include <mln/labeling/mean_values.hh> + +#include <mln/fun/l2l/wrap.hh> namespace mln @@ -33,9 +37,7 @@ namespace mln } - - -int main(int, char *argv[]) +int main(int argc, char *argv[]) { using namespace mln; @@ -48,16 +50,48 @@ int main(int, char *argv[]) typedef image2d<rgb8> I; typedef image2d<hsl_f> J; + if (argc < 3) + { + std::cout << "Usage: " << argv[0] << " <ima.ppm> <closure_lambda>" + << std::endl; + } + I input_; io::ppm::load(input_, argv[1]); J input = level::convert(hsl_f(), input_); + io::ppm::save(level::transform(input, hsl2rgb()), "input-hsl.ppm"); - std::cout << "input_rgb(p) = " << input_(point2d(310,0)) << " - input_hsl(p) = " << input(point2d(310,0)) - << " hsl2rgb(p) = " << hsl2rgb()(input(point2d(310,0))) - << std::endl; - std::cout << "input_rgb(p) = " << input_(point2d(311,0)) << " - input_hsl(p) = " << input(point2d(311,0)) - << " hsl2rgb(p) = " << hsl2rgb()(input(point2d(311,0))) - << std::endl; + { + I tmp = level::transform(input, hsl2rgb()); + + image2d<int_u8> grad_hue; + initialize(grad_hue, input); + data::fill(grad_hue, extract::blue(tmp)); + image2d<int_u8> grad_sat; + initialize(grad_sat, input); + data::fill(grad_sat, extract::green(tmp)); + image2d<int_u8> grad_lum; + initialize(grad_lum, input); + data::fill(grad_lum, extract::blue(tmp)); + + + grad_hue = morpho::gradient(grad_hue, win_c4p()); + io::pgm::save(grad_hue, "hsl2rgb_grad_hue.pgm"); + + grad_sat = morpho::gradient(grad_sat, win_c4p()); + io::pgm::save(grad_sat, "hsl2rgb_grad_sat.pgm"); + + grad_lum = morpho::gradient(grad_lum, win_c4p()); + io::pgm::save(grad_lum, "hsl2rgb_grad_lum.pgm"); + + image2d<value::int_u8> grad; + initialize(grad, grad_hue); + mln_piter_(image2d<value::int_u8>) p(grad.domain()); + for_all(p) + grad(p) = math::max(grad_hue(p), math::max(grad_sat(p), grad_lum(p))); + io::pgm::save(grad, "hsl2rgb_grad_rgb.pgm"); + + } /// Compute the gradient on each component of the HSL image. /// Then keep the max values in the three images. @@ -70,9 +104,15 @@ int main(int, char *argv[]) image2d<float> grad_lum; initialize(grad_lum, input); data::fill(grad_lum, extract::lum(input)); + grad_hue = morpho::gradient(grad_hue, win_c4p()); +// io::pgm::save(grad_hue, "hsl2rgb_grad_hue.pgm"); + grad_sat = morpho::gradient(grad_sat, win_c4p()); +// io::pgm::save(grad_sat, "hsl2rgb_grad_sat.pgm"); + grad_lum = morpho::gradient(grad_lum, win_c4p()); +// io::pgm::save(grad_lum, "hsl2rgb_grad_lum.pgm"); image2d<value::int_u8> grad; initialize(grad, grad_hue); @@ -82,14 +122,19 @@ int main(int, char *argv[]) io::pgm::save(grad, "hsl2rgb_grad.pgm"); image2d<int_u8> clo = morpho::closing_area(grad, c4(), 10); +// image2d<int_u8> clo = morpho::closing_volume(grad, c4(), atoi(argv[2])); io::pgm::save(clo, "hsl2rgb_clo_a100.pgm"); label_16 nbasins; image2d<label_16> wshed = morpho::meyer_wst(clo, c4(), nbasins); io::dump::save(wshed, "hsl2rgb_wshed.dump"); std::cout << "nbasins = " << nbasins << std::endl; - io::pgm::save(level::transform(wshed, convert::to_fun(foo)), + + io::pgm::save(level::transform(wshed, fun::l2l::wrap<int_u8>()), "hsl2rgb_wshed.pgm"); + io::ppm::save(labeling::mean_values(level::transform(input, hsl2rgb()), wshed, nbasins), + "hsl2rgb_wshed_mean_colors.ppm"); + I out = level::transform(input, hsl2rgb()); io::ppm::save(out, "hsl2rgb_out.ppm"); diff --git a/milena/sandbox/lazzara/irm/irm_seg_with_mm_and_rag.cc b/milena/sandbox/lazzara/irm/irm_seg_with_mm_and_rag.cc new file mode 100644 index 0000000..9647986 --- /dev/null +++ b/milena/sandbox/lazzara/irm/irm_seg_with_mm_and_rag.cc @@ -0,0 +1,93 @@ +#include <iostream> +#include <mln/core/image/image2d.hh> + +#include <mln/core/alias/neighb2d.hh> +#include <mln/core/alias/window2d.hh> +#include <mln/core/image/image_if.hh> + +#include <mln/io/ppm/save.hh> +#include <mln/io/ppm/load.hh> +#include <mln/io/pgm/load.hh> +#include <mln/io/pgm/save.hh> +#include <mln/io/dump/save.hh> + +#include <mln/value/rgb8.hh> +#include <mln/value/int_u8.hh> +#include <mln/value/label_16.hh> + +#include <mln/level/transform.hh> + +#include <mln/labeling/mean_values.hh> + +#include <mln/convert/to_fun.hh> + +#include <mln/morpho/gradient.hh> +#include <mln/morpho/closing_area.hh> +#include <mln/morpho/meyer_wst.hh> + +#include <mln/fun/l2l/wrap.hh> + +#include <mln/core/var.hh> +#include <mln/morpho/elementary/dilation.hh> + +#include <mln/core/routine/extend.hh> + +mln::value::int_u8 foo(unsigned u) +{ + return u == 0 ? + 0 : // wshed line + 1 + (u - 1) % 255; // basin +} + + +int main(int argc, char *argv[]) +{ + using namespace mln; + using value::int_u8; + using value::rgb8; + using value::label_16; + + if (argc < 4) + { + std::cout << "Usage: " << argv[0] << " <ima.pgm> <ima.ppm> <closure_lambda>" + << std::endl; + return 1; + } + + image2d<int_u8> irm; + io::pgm::load(irm, argv[1]); + + image2d<rgb8> irm_color; + io::ppm::load(irm_color, argv[2]); + + + image2d<int_u8> grad = morpho::gradient(irm, win_c4p()); + io::pgm::save(grad, "tmp_grad_c4p.pgm"); + +// image2d<int_u8> clo = morpho::closing_area(grad, c4(), atoi(argv[3])); +// io::pgm::save(clo, "tmp_clo_a100.pgm"); + + label_16 nbasins; + image2d<label_16> wshed = morpho::meyer_wst(grad, c4(), nbasins); + std::cout << "nbasins = " << nbasins << std::endl; + + io::pgm::save(level::transform(wshed, fun::l2l::wrap<int_u8>()), + "tmp_wshed.pgm"); + + + mln_VAR(vol2_, + morpho::elementary::dilation(extend(wshed | (pw::value(wshed) == 0u), + wshed), + c8())); + + data::fill((wshed | (pw::value(wshed) == 0u)).rw(), vol2_); + + io::ppm::save(labeling::mean_values(irm_color, wshed, nbasins), + "tmp_wshed_mean_colors.ppm"); + + data::fill((irm_color | (pw::value(wshed) == 0u)).rw(), literal::yellow); + + io::ppm::save(irm_color, "tmp_wshed_color.ppm"); + io::dump::save(wshed, "tmp_wshed.dump"); + +} diff --git a/milena/sandbox/lazzara/irm/wst_rag.cc b/milena/sandbox/lazzara/irm/wst_rag.cc index e397ba7..b88b8ec 100644 --- a/milena/sandbox/lazzara/irm/wst_rag.cc +++ b/milena/sandbox/lazzara/irm/wst_rag.cc @@ -17,9 +17,9 @@ #include <mln/core/image/line_graph_elt_neighborhood.hh> #include <mln/morpho/elementary/dilation.hh> #include <mln/labeling/mean_values.hh> - +#include <mln/extension/adjust_fill.hh> #include <mln/extract/all.hh> - +#include <mln/make/region_adjacency_graph.hh> // Given a color image and a wshed image, computes the component graph. // Vertex values are computed thanks to a RGB image. @@ -27,71 +27,20 @@ namespace mln { - - template <typename I, typename N> - util::graph - make_graph(const I& w, const N& nbh, const mln_value(I)& nbasins) + template <typename V> + value::int_u8 dist(const V& c1, const V& c2) { + unsigned d = math::diff_abs(c1.red(), c2.red()); + unsigned d_; + d_ = math::diff_abs(c1.green(), c2.green()); - image2d<bool> adj(box2d(nbasins.next(), nbasins.next())); - data::fill(adj, false); - - typedef mln_value(I) L; - L l1, l2; - mln_piter(I) p(w.domain()); - mln_niter(N) n(nbh, p); - for_all(p) - { - if (w(p) != 0u) - continue; - // p is in the watershed line. - l1 = l2 = 0; - for_all(n) - if (w.has(n) && w(n) != 0u) - { - if (l1 == 0u) // First label to be stored. - l1 = w(n); - else - if (w(n) != l1) // Useless: && l2 == 0) - { // Second label to be stored. - mln_invariant(l2 == 0u); - l2 = w(n); - break; - } - } - if (l2 == 0u || l1 == 0u) - continue; - if (l2 < l1) - std::swap(l1, l2); - - // adjacency l1 l2 - adj(point2d(l1,l2)) = true; - adj(point2d(l2,l1)) = true; - } + if (d_ > d) + d = d_; - // Construct graph. - util::graph g; - g.add_vertices(nbasins.next()); - for (unsigned i = 1; i < geom::nrows(adj); ++i) - for (unsigned j = 1; j < i; ++j) - if (adj(point2d(i,j))) - g.add_edge(i, j); + d_ = math::diff_abs(c1.blue(), c2.blue()); - return g; - } - - - - - template <typename V> - value::int_u8 dist(const V& c1, const V& c2) - { - unsigned d = 0; - d += (math::diff_abs(c1.red(), c2.red()) + 2) / 3; - d += (math::diff_abs(c1.green(), c2.green()) + 2) / 3; - d += (math::diff_abs(c1.blue(), c2.blue()) + 2) / 3; - if (d > 255) - d = 255; + if (d_ > d) + d = d_; return d; } @@ -218,12 +167,12 @@ namespace mln image2d<mln_value(I)> make_debug_graph_image(const I& input, const V& ima_v, const E& ima_e, - unsigned box_size) + unsigned box_size, const value::rgb8& bg) { image2d<mln_value(I)> ima; initialize(ima, input); - data::fill(ima, literal::white); + data::fill(ima, bg); debug::draw_graph(ima, ima_v.domain(), pw::cst(mln_value(I)(literal::green)), edge_to_color<E, mln_value(I)>(ima_e)); @@ -258,7 +207,7 @@ int main(int argc, char *argv[]) typedef image2d<rgb8> I; typedef image2d<label_16> J; - if (argc < 5) + if (argc < 6) { std::cout << argv[0] << " <input.ppm> <wsh-label16.dump> <nbasins> <box_size> <dist_max>" << std::endl << std::endl; @@ -282,15 +231,17 @@ int main(int argc, char *argv[]) label_16 nbasins = atoi(argv[3]); std::cout << "nbasins = " << nbasins << std::endl; - util::graph g = make_graph(vol, c4(), nbasins); + util::graph g = make::graph(vol, c4(), nbasins); // Compute value distances with a RGB image. mln_VAR(ima_v, make_vertex_graph_image(g, input, vol, nbasins)); mln_VAR(ima_e, make_edge_graph_image(ima_v, g)); //DEBUG -// io::ppm::save(make_debug_graph_image(input, ima_v, ima_e, box_size), -// "wst_rag_graph_image.ppm"); + io::ppm::save(make_debug_graph_image(input, ima_v, ima_e, box_size, literal::white), + "wst_rag_graph_image_white.ppm"); + io::ppm::save(make_debug_graph_image(input, ima_v, ima_e, box_size, literal::black), + "wst_rag_graph_image_black.ppm"); mln_piter_(ima_e_t) e(ima_e.domain()); @@ -313,16 +264,17 @@ int main(int argc, char *argv[]) for (unsigned i = 0; i < parent.nelements(); ++i) { unsigned p = find_root(parent, i); + mln_assertion(parent[p] == find_root(parent, i)); if (new_label[p] == 0) new_label[p] = nbasins2++; f(i) = new_label[p]; } - mln_invariant(f(0) == 0); + mln_invariant(f(0) == 0u); --nbasins2; //nbasins2 does not count the basin with label 0. std::cout << "nbasins2 = " << nbasins2 << std::endl; J vol2 = level::transform(vol, f); - util::graph g2 = make_graph(vol2, c4(), nbasins2); + util::graph g2 = make::graph(vol2, c4(), nbasins2); // Compute value distances with a RGB image. mln_VAR(ima_v2, make_vertex_graph_image(g2, input, vol2, nbasins2)); mln_VAR(ima_e2, make_edge_graph_image(ima_v2, g2)); @@ -336,6 +288,8 @@ int main(int argc, char *argv[]) io::ppm::save(labeling::mean_values(input, vol2, nbasins2), "wst_rag_mean_colors.ppm"); - io::ppm::save(make_debug_graph_image(input, ima_v2, ima_e2, box_size), - "wst_rag_graph_image2.ppm"); + io::ppm::save(make_debug_graph_image(input, ima_v2, ima_e2, box_size, literal::white), + "wst_rag_graph_image2_white.ppm"); + io::ppm::save(make_debug_graph_image(input, ima_v2, ima_e2, box_size, literal::black), + "wst_rag_graph_image2_black.ppm"); } diff --git a/milena/sandbox/lazzara/irm/wst_rag_hsl.cc b/milena/sandbox/lazzara/irm/wst_rag_hsl.cc index 156f1b3..48cca5a 100644 --- a/milena/sandbox/lazzara/irm/wst_rag_hsl.cc +++ b/milena/sandbox/lazzara/irm/wst_rag_hsl.cc @@ -1,6 +1,5 @@ #include <mln/essential/2d.hh> - #include <mln/core/alias/dpoint2d.hh> #include <mln/core/alias/vec3d.hh> #include <mln/core/image/line_graph_elt_neighborhood.hh> @@ -32,9 +31,10 @@ #include <mln/value/label_8.hh> #include <mln/value/rgb16.hh> #include <mln/value/rgb8.hh> - #include <mln/value/hsl.hh> +#include <mln/make/region_adjacency_graph.hh> + // Given a color image and a wshed image, computes the component graph. // Vertex values are computed thanks to a HSL image. @@ -44,71 +44,33 @@ namespace mln { - template <typename I, typename N> - util::graph - make_graph(const I& w, const N& nbh, const mln_value(I)& nbasins) + struct hsl2rgb : Function_v2v<hsl2rgb> { + typedef value::rgb8 result; - image2d<bool> adj(box2d(nbasins.next(), nbasins.next())); - data::fill(adj, false); - - typedef mln_value(I) L; - L l1, l2; - mln_piter(I) p(w.domain()); - mln_niter(N) n(nbh, p); - for_all(p) + value::rgb8 operator()(const value::hsl_f& v) const { - if (w(p) != 0u) - continue; - // p is in the watershed line. - l1 = l2 = 0; - for_all(n) - if (w.has(n) && w(n) != 0u) - { - if (l1 == 0u) // First label to be stored. - l1 = w(n); - else - if (w(n) != l1) // Useless: && l2 == 0) - { // Second label to be stored. - mln_invariant(l2 == 0u); - l2 = w(n); - break; - } - } - if (l2 == 0u || l1 == 0u) - continue; - if (l2 < l1) - std::swap(l1, l2); - - // adjacency l1 l2 - adj(point2d(l1,l2)) = true; - adj(point2d(l2,l1)) = true; + value::rgb8 res((v.hue() / 360.0f) * 255.0f, + v.sat() * 255.0f, + v.lum()); + return res; } - - // Construct graph. - util::graph g; - g.add_vertices(nbasins.next()); - for (unsigned i = 1; i < geom::nrows(adj); ++i) - for (unsigned j = 1; j < i; ++j) - if (adj(point2d(i,j))) - g.add_edge(i, j); - - return g; - } + }; - value::int_u8 dist(const value::hsl_f& c1, const value::hsl_f& c2) + value::int_u8 dist(const value::rgb8& c1, const value::rgb8& c2) { unsigned d = 0; - d += (math::diff_abs(c1.hue(), c2.hue()) + 2) / 3; - d += (math::diff_abs(c1.sat(), c2.sat()) + 2) / 3; - d += (math::diff_abs(c1.lum(), c2.lum()) + 2) / 3; + d += (math::diff_abs(c1.red(), c2.red()) + 2) / 3; + d += (math::diff_abs(c1.green(), c2.green()) + 2) / 3; + d += (math::diff_abs(c1.blue(), c2.blue()) + 2) / 3; if (d > 255) d = 255; return d; } + // ima_v, image on graph vertices; value = mean color per vertex (watershed basin) template <typename I> inline @@ -134,7 +96,7 @@ namespace mln mln_piter(ima_e_t) e(ima_e.domain()); for_all(e) // in ima_e ima_e(e) = dist(ima_v.function()(e.element().v1()), - ima_v.function()(e.element().v2())); + ima_v.function()(e.element().v2())); return ima_e; } @@ -147,15 +109,15 @@ namespace mln { // Cf. sandbox/theo/color/segment_rgb_pixels.cc - util::array<value::hsl_f> m_3f = labeling::compute(accu::mean<mln_value(I)>(), + util::array<vec3d_f> m_3f = labeling::compute(accu::mean<mln_value(I)>(), input, // input color image w, // watershed labeling nbasins); - m_3f[0] = value::hsl_f(0,0,0);; + m_3f[0] = literal::zero; util::array<mln_value(I)> m; convert::from_to(m_3f, m); - m[0] = value::hsl_f(360,0.5,255); + m[0] = literal::yellow; return m; } @@ -269,7 +231,7 @@ int main(int argc, char *argv[]) typedef image2d<hsl_f> I; typedef image2d<label_16> J; - if (argc < 5) + if (argc < 6) { std::cout << argv[0] << " <input.ppm> <wsh-label16.dump> <nbasins> <box_size> <dist_max>" << std::endl << std::endl; @@ -283,9 +245,10 @@ int main(int argc, char *argv[]) unsigned box_size = atoi(argv[4]); - K input_; - io::ppm::load(input_, argv[1]); - I input = level::convert(hsl_f(), input_); + K input; + io::ppm::load(input, argv[1]); + I input_ = level::convert(hsl_f(), input); + input = level::transform(input_, hsl2rgb()); J vol; io::dump::load(vol, argv[2]); @@ -293,46 +256,53 @@ int main(int argc, char *argv[]) label_16 nbasins = atoi(argv[3]); std::cout << "nbasins = " << nbasins << std::endl; - util::graph g = make_graph(vol, c4(), nbasins); + J vol2; + unsigned nbasins2; + fun::i2v::array<label_16> f; + { + util::graph g = make::graph(vol, c4(), nbasins); - mln_VAR(ima_v, make_vertex_graph_image(g, input, vol, nbasins)); - mln_VAR(ima_e, make_edge_graph_image(ima_v, g)); + mln_VAR(ima_v, make_vertex_graph_image(g, input, vol, nbasins)); + mln_VAR(ima_e, make_edge_graph_image(ima_v, g)); - //DEBUG - io::ppm::save(make_debug_graph_image(input, ima_v, ima_e, box_size), - "wst_rag_graph_image.ppm"); + //DEBUG + io::ppm::save(make_debug_graph_image(input, ima_v, ima_e, box_size), + "wst_rag_graph_image.ppm"); - mln_piter_(ima_e_t) e(ima_e.domain()); - util::array<label_16> parent(g.v_nmax()); - for (unsigned i = 0; i < parent.nelements(); ++i) - parent[i] = i; + mln_piter_(ima_e_t) e(ima_e.domain()); + util::array<label_16> parent(g.v_nmax()); + for (unsigned i = 0; i < parent.nelements(); ++i) + parent[i] = i; - for_all(e) - { - unsigned v1 = e.element().v1(); - unsigned v2 = e.element().v2(); - if (ima_e(e) <= (unsigned)(atoi(argv[5])) - && find_root(parent, v1) != find_root(parent, v2)) - parent[find_root(parent, v1)] = find_root(parent, v2); - } + for_all(e) + { + unsigned v1 = e.element().v1(); + unsigned v2 = e.element().v2(); + if (ima_e(e) <= (unsigned)(atoi(argv[5])) + && find_root(parent, v1) != find_root(parent, v2)) + parent[find_root(parent, v1)] = find_root(parent, v2); + } - fun::i2v::array<label_16> f(parent.nelements()); - std::vector<unsigned> new_label(parent.nelements(), 0); - unsigned nbasins2 = 0; - for (unsigned i = 0; i < parent.nelements(); ++i) - { - unsigned p = find_root(parent, i); - if (new_label[p] == 0) - new_label[p] = nbasins2++; - f(i) = new_label[p]; - } - mln_invariant(f(0) == 0); - --nbasins2; //nbasins2 does not count the basin with label 0. - std::cout << "nbasins2 = " << nbasins2 << std::endl; + f = fun::i2v::array<label_16>(parent.nelements()); + std::vector<unsigned> new_label(parent.nelements(), 0); + nbasins2 = 0; + for (unsigned i = 0; i < parent.nelements(); ++i) + { + unsigned p = find_root(parent, i); + if (new_label[p] == 0) + new_label[p] = nbasins2++; + f(i) = new_label[p]; + } + mln_invariant(f(0) == 0); + --nbasins2; //nbasins2 does not count the basin with label 0. - J vol2 = level::transform(vol, f); - util::graph g2 = make_graph(vol2, c4(), nbasins2); + std::cout << "nbasins2 = " << nbasins2 << std::endl; + } + // debug::println(vol); + vol2 = level::transform(vol, f); + // debug::println(vol2); + util::graph g2 = make::graph(vol2, c4(), nbasins2); // Compute values distance on the HSL Image. mln_VAR(ima_v2, make_vertex_graph_image(g2, input, vol2, nbasins2)); @@ -340,14 +310,14 @@ int main(int argc, char *argv[]) mln_VAR(vol2_, morpho::elementary::dilation(extend(vol2 | (pw::value(vol2) == 0u), - vol2), - c8())); + vol2), + c8())); data::fill((vol2 | (pw::value(vol2) == 0u)).rw(), vol2_); - io::ppm::save(labeling::mean_values(input_, vol2, nbasins2), - "wst_rag_mean_colors.ppm"); - io::ppm::save(make_debug_graph_image(input_, ima_v2, ima_e2, box_size), - "wst_rag_graph_image2.ppm"); + io::ppm::save(labeling::mean_values(input, vol2, nbasins2), + "wst_rag_mean_colors.ppm"); + io::ppm::save(make_debug_graph_image(input, ima_v2, ima_e2, box_size), + "wst_rag_graph_image2.ppm"); } -- 1.5.6.5
participants (1)
-
Guillaume Lazzara