From: Kris T. <kri...@gm...> - 2012-09-07 12:21:40
|
On 07 September 2012 12:55 Carnë Draug wrote > On 7 September 2012 13:06, Kris Thielemans wrote: > > 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. > > What does matlab do if the double matrix has values different from 0 and 1? > It seems to compare with 0 as I do above. For example, the following 2 tests work in matlab 2011b tmp=ones([2,3,4]);tmp(2,2,2)=.3;isequal(bwlabeln(tmp),ones(size(tmp))) tmp=randn([2,3,4]);isequal(bwlabeln(tmp),tmp~=0) Kris |