[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Selecting elements in an image based on area
From: |
Samuel Setchell |
Subject: |
Re: Selecting elements in an image based on area |
Date: |
Sat, 16 Jul 2011 14:43:17 +0100 |
When running the suggested :
> mask = ismember(imlabel,idx);
I get the error:
octave-3.2.3:58> mask = ismember(grains,fix);
error: `ismembc' undefined near line 150 column 16
I tried the previous suggestion:
>> mask = any(bsxfun(@eq, x, reshape(idx, 1,1, length(idx))),3);
and
mask=and(bsxfun(@eq,grains,reshape(fix,1,1,length(fix))),3);
octave-3.2.3:56> mask
mask =
ans(:,:,1) =
which was a file full of 0's and no dimensions to the matrix
Thanks so much for the help so far, it has been extremely helpful!
Regards
Sam
On 13 Jul 2011, at 19:12, Jordi Gutiérrez Hermoso wrote:
> 2011/7/13 Jordi Gutiérrez Hermoso <address@hidden>:
>> 2011/7/13 Samuel Setchell <address@hidden>:
>>> I think I have grabbed one designed for MATLAB....which had been
>>> ported for mac.
>>
>> That's odd. I wonder why would someone write one of those. Both Octave
>> and Matlab ship their own, and an m-file implementatino of bwlabel is
>> bound to be very slow.
>>
>>> seems to work fine. I tried running regionprops.m on my output and
>>> got:
>>>
>>> ans =
>>> {
>>> 1x381 struct array containing the fields:
>>>
>>> Area
>>> Centroid
>>> BoundingBox
>>> }
>>>
>>> Is this correct?
>>
>> Looks like it. Now assign ans to some variable, say regions = ans;
>> and do
>>
>> idx = find([regions.Area] > lo & [regions.Area] < hi)
>>
>> to give you the indices of the regions that have area higher than your
>> lower bound lo and lower than your upper bound hi. Now if imlabel is
>> the outout of bwlabel, you can do
>>
>> mask = any(bsxfun(@eq, x, reshape(idx, 1,1, length(idx))),3);
>
> Sorry for obscuring this so much (and for using x instead of imlabel).
> This is much better:
>
> mask = ismember(imlabel,idx);
>
> HTH,
> - Jordi G. H.
- Selecting elements in an image based on area, Samuel Setchell, 2011/07/01
- Re: Selecting elements in an image based on area, Jordi Gutiérrez Hermoso, 2011/07/01
- Message not available
- Re: Selecting elements in an image based on area, Jordi Gutiérrez Hermoso, 2011/07/07
- Re: Selecting elements in an image based on area, Samuel Setchell, 2011/07/10
- Re: Selecting elements in an image based on area, Jordi Gutiérrez Hermoso, 2011/07/13
- Re: Selecting elements in an image based on area, Jordi Gutiérrez Hermoso, 2011/07/13
- Re: Selecting elements in an image based on area, Samuel Setchell, 2011/07/13
- Re: Selecting elements in an image based on area, Jordi Gutiérrez Hermoso, 2011/07/13
- Re: Selecting elements in an image based on area, Jordi Gutiérrez Hermoso, 2011/07/13
- Re: Selecting elements in an image based on area,
Samuel Setchell <=
- Re: Selecting elements in an image based on area, John Swensen, 2011/07/13