From: Kris T. <kri...@gm...> - 2012-09-07 11:06:15
|
Hi Jordi My initial impression if your newest bwlabeln implementation seems good! It's not so easy to test this exhaustively of course. But for instance this works tmp=ones(2,2,3); % add another "blob" somewhere further away tmp(3:4, 4:6, 2:3)=ones(2,3,2); res=bwlabeln(tmp~=0); % we should have found 2 blobs expectedres=ones(2,2,3); expectedres(3:4, 4:6, 2:3)=ones(2,3,2)*2; assert(res, expectedres) The test above is somewhat problematic, as bwlabeln could just as well have found the blobs in different order. I haven't bothered to come up with a better test code. I have only 1 problem. In my matlab code, I normally pass a (double) array with 0,1 to bwlabeln. This doesn't work for your implementation: bwlabeln(ones([2,2,3])) error: bwlabeln: first input argument must be a 'logical' ND-array I can fix this by converting to bools of course bwlabeln(ones([2,2,3]~=0)) but for matlab compatibility, ideally bwlabeln would do that itself. The same holds for bwlabel by the way. Thanks for this! Kris > -----Original Message----- > From: jo...@gm... [mailto:jo...@gm...] On Behalf Of Jordi > Gutiérrez Hermoso > Sent: 05 September 2012 21:15 > To: Kris Thielemans > Cc: Octave Forge List > Subject: Re: [OctDev] bwlabeln "finished" > > Just a heads up to everyone, I've improved the bwlabeln code a bit to > make it faster. Please let me know how it works for you. > > TIA, > - Jordi G. H. |