From: <jo...@us...> - 2012-09-05 20:02:46
|
Revision: 10966 http://octave.svn.sourceforge.net/octave/?rev=10966&view=rev Author: jordigh Date: 2012-09-05 20:02:40 +0000 (Wed, 05 Sep 2012) Log Message: ----------- Remove zero padding from bwlabeln output Modified Paths: -------------- trunk/octave-forge/main/image/src/bwlabeln.cc trunk/octave-forge/main/image/src/union-find.h++ Modified: trunk/octave-forge/main/image/src/bwlabeln.cc =================================================================== --- trunk/octave-forge/main/image/src/bwlabeln.cc 2012-09-05 19:14:14 UTC (rev 10965) +++ trunk/octave-forge/main/image/src/bwlabeln.cc 2012-09-05 20:02:40 UTC (rev 10966) @@ -412,14 +412,17 @@ ids_to_label[id] = label; } else - { label = try_label -> second; - } L_vec[*idx] = label; } - rval(0) = L; + // Remove the zero padding... + Array<idx_vector> inner_slice (dim_vector (size_vec.length (), 1)); + for (octave_idx_type i = 0; i < padded_size.length (); i++) + inner_slice(i) = idx_vector (1, padded_size(i) - 1); + + rval(0) = L.index (inner_slice); rval(1) = ids_to_label.size (); return rval; } Modified: trunk/octave-forge/main/image/src/union-find.h++ =================================================================== --- trunk/octave-forge/main/image/src/union-find.h++ 2012-09-05 19:14:14 UTC (rev 10965) +++ trunk/octave-forge/main/image/src/union-find.h++ 2012-09-05 20:02:40 UTC (rev 10966) @@ -71,8 +71,6 @@ voxel *v1 = voxels[root1], *v2 = voxels[root2]; if (root1 != root2) { - - if ( v1->rank > v2->rank) v1->parent = root2; else if (v1->rank < v2->rank) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |