From: N JK on 21 Apr 2010 15:23 Hi Matlab users, Does anyone know of a method that will pull out the indices of multiple polygons specified by a mask, for example, say I have a matrix with two polygons: mask = [ 0 1 0 0 0; 0 1 1 0 0; 0 0 0 0 1; 0 0 0 1 1;] The problem is trivial with one polygon, but separating indices into separate polygons takes a little more work... anyone know of the function I'm looking for? Thanks! NK
From: Walter Roberson on 21 Apr 2010 15:48 N JK wrote: > Hi Matlab users, Does anyone know of a method that will pull out the > indices of multiple polygons specified by a mask, for example, say I > have a matrix with two polygons: > > mask = [ 0 1 0 0 0; > 0 1 1 0 0; > 0 0 0 0 1; > 0 0 0 1 1;] > > The problem is trivial with one polygon, but separating indices into > separate polygons takes a little more work... anyone know of the > function I'm looking for? use bwlabel() to separate the polygons; then the indices become simple matters of find(labeledmask == polygonnumber)
|
Pages: 1 Prev: invert a large number of matrices Next: rank of the logical matrix A in GF(2)? |