From: ImageAnalyst on 5 Aug 2010 14:03 On Aug 5, 12:45 pm, "Fred Vrancken" <fred_3...(a)hotmail.com> wrote: > If I understand correctly (because i'm pretty new to matlab) > the code must look like this : > > for columnNumber = 1:200(BWfinal, 2) > topRows(columnNumber) = find(BWfinal(:, columnNumber)>0, 1, > 'first'); > bottomRows(columnNumber) = find(BWfinal(:, columnNumber)>0, 1, > 'last'); > end > > BWfinal = imagearray black & white so 0 and 1's > 200 is the size = max number of columns in BWfinal > > However i'm not sure what the (BWfinal,2) is doing after the 1:200 statement ------------------------------------------------------------- size() is a function. You do not actually replace "size" with the actual size of your array (as in "200(BWfinal, 2)" ). size() will calculate the value 200 from the BWfinal array. If you want, you can do this instead: [rows columns numberOfColorBands] = size(BWfinal) for columnNumber = 1 : columns ..... end You might see if you can get Joseph's code - it looks like they've put quite a bit of work into what is substantially the same thing you want to do. There are probably several nuances that I'm not aware of.
From: Fred Vrancken on 5 Aug 2010 14:37
> size() is a function. You do not actually replace "size" with the > actual size of your array (as in "200(BWfinal, 2)" ). size() will > calculate the value 200 from the BWfinal array. If you want, you can > do this instead: > > [rows columns numberOfColorBands] = size(BWfinal) > for columnNumber = 1 : columns > .... > end > You might see if you can get Joseph's code - it looks like they've put > quite a bit of work into what is substantially the same thing you want > to do. There are probably several nuances that I'm not aware of. ---------------------------------------------------------------------------------------------------------------------- I figured out the code just after i send the message sorry about that. However when i want to use it with my b&w pic i get the following error ''??? Improper assignment with rectangular empty matrix.'' BWfinal is a 153x200 logical array Any tips? |