Prev: Vertical line
Next: Eigen value decomposition
From: Rebecca on 6 Jun 2010 16:44 I'm using this code to obtain objects between 40 and 800 pixels: B = bwareaopen(B, 40); Bnot = bwareaopen(B, 800); B = B & ~Bnot; I would like to find a way to do this faster and more efficiently. Is there a better/more efficient way to do this?
From: ImageAnalyst on 6 Jun 2010 20:34 I think a way which could be faster or more efficient would be to use regionprops() along with ismember(), as shown in my image processing demo: http://www.mathworks.com/matlabcentral/fileexchange/25157 [snip] allowableAreaIndexes = allBlobAreas > 40 && allBlobAreas < 800; % Take the objects in the rang 40-800 keeperIndexes = find(allowableIntensityIndexes & allowableAreaIndexes); % Extract only those blobs that meet our criteria, and % eliminate those blobs that don't meet our criteria. % Note how we use ismember() to do this. keeperBlobsImage = ismember(labeledImage, keeperIndexes); [snip] You'd just have to time them both and see. bwareaopen does an implicit labeling and area calculation, but then you're doing it again since you call it twice and then ANDing them together. With the way I said, you'd only do labeling and area measurement once.
|
Pages: 1 Prev: Vertical line Next: Eigen value decomposition |