
Index: olena/ChangeLog from Giovanni Palma <giovanni@lrde.epita.fr> * tests/topo/tests/tarjan: Correct test. * tests/topo/tests/md5_topo_tarjan_flat-zone_hh0: Correct test. * oln/topo/tarjan/tarjan_with_attr.hh: Correct code. Index: olena/tests/topo/tests/tarjan --- olena/tests/topo/tests/tarjan Thu, 31 Jul 2003 11:12:56 +0200 sylvain (oln/u/30_test-tarja 1.1 600) +++ olena/tests/topo/tests/tarjan Fri, 02 Apr 2004 18:23:33 +0200 palma_g (oln/u/30_test-tarja 1.1 600) @@ -29,8 +29,8 @@ input_t src = load(rdata("object")); flat_zone<input_t> cc(src); - - if (cc.nlabels() == 79) + cc.get_compute(oln::neighb_c4()); + if (cc.ncomps() == 78) OK_OR_FAIL; return fail; Index: olena/tests/topo/tests/md5_topo_tarjan_flat-zone_hh0 --- olena/tests/topo/tests/md5_topo_tarjan_flat-zone_hh0 Tue, 23 Mar 2004 15:48:17 +0100 palma_g (oln/m/12_md5_topo_t 1.1 644) +++ olena/tests/topo/tests/md5_topo_tarjan_flat-zone_hh0 Fri, 02 Apr 2004 18:31:24 +0200 palma_g (oln/m/12_md5_topo_t 1.1 644) @@ -9,16 +9,18 @@ int main() { -oln::utils::key::value_type data_key[16] = {0x23, 0x57, 0x37, 0xc5, 0xf5, 0xd1, 0x56, 0x6b, 0x6a, 0x2b, 0x6b, 0xe6, 0x59, 0x5b, 0xbb, 0x57}; + oln::utils::key::value_type data_key[16] = {0xd2, 0x7, 0xe9, 0x82, 0xdc, + 0x89, 0x54, 0x89, 0x14, 0xc, + 0xa5, 0xaa, 0x45, 0x2, 0x79, + 0xdc}; oln::utils::key key(data_key); - typedef oln::image2d<ntg:: -int_u8> img_type; + typedef oln::image2d<ntg::int_u8> img_type; img_type in = oln::load(rdata("test-cmap.pgm")); oln::topo::tarjan::flat_zone<img_type> z(in); - if (oln::utils::md5(oln::convert::stretch_balance<ntg:: -int_u8>(z.label, 0, 255)) == key) + + if (oln::utils::md5(oln::convert::stretch_balance<ntg::int_u8>(z.get_compute(oln::neighb_c4()), 0, 255)) == key) std::cout << "OK" << std::endl; else { Index: olena/oln/topo/tarjan/tarjan_with_attr.hh --- olena/oln/topo/tarjan/tarjan_with_attr.hh Fri, 02 Apr 2004 16:53:54 +0200 palma_g (oln/m/46_tarjan_wit 1.2 644) +++ olena/oln/topo/tarjan/tarjan_with_attr.hh Fri, 02 Apr 2004 18:06:54 +0200 palma_g (oln/m/46_tarjan_wit 1.2 644) @@ -179,22 +179,17 @@ // Resolving phase std::map<comp_type, comp_type> cmps; - comp_type nc = 0; ncomps_ = 0; - // unsigned i = 0; for (int p = I.size() - 1; p >= 0; --p) { point_type p_p = I[p]; - if (cmps.find(comp_value_[find_root(to_comp_[p_p])]) == cmps.end()) + if (cmps.find(find_root(to_comp_[p_p])) == cmps.end()) { - ++ncomps_; - // ++i; - // std::cout << "new component\n"; - cmps[comp_value_[find_root(to_comp_[p_p])]] = nc; - comp_value_[find_root(to_comp_[p_p])] = nc++; + cmps[comp_value_[find_root(to_comp_[p_p])]] = ncomps_; + comp_value_[find_root(to_comp_[p_p])] = ncomps_++; } } - // std::cout << i << " components\n"; + image_out_type output(input_.size()); for (int p = I.size() - 1; p >= 0; --p) { -- Giovanni Palma EPITA - promo 2005 - membre d'EpX - LRDE Mob. : +33 (0)6 60 97 31 74