I use bwareaopen to remove small objects. Is there a function to remove the big objects? I'm trying to adapt bwareaopen however haven't been successful so far. Thanks
For ref: Here's a link to the help of bwareaopen.
I use bwareaopen to remove small objects. Is there a function to remove the big objects? I'm trying to adapt bwareaopen however haven't been successful so far. Thanks
For ref: Here's a link to the help of bwareaopen.
 On
                        
                            
                        
                        
                            On
                            
                                                    
                    
                I found an easy way to tackle this problem described here:
"To keep only objects between, say, 30 pixels and 50 pixels in area, you can use the BWAREAOPEN command, like this:"
LB = 30;
UB = 50;
Iout = xor(bwareaopen(I,LB),  bwareaopen(I,UB));
Another way if you don't want to use
bwareaopenis to useregionprops, specifically with theAreaandPixelIdxListattributes, filter out the elements that don't conform to the area range you want, then use the remaining elements and create a new mask.Areacaptures the total area of each shape whilePixelIdxListcaptures the column major linear indices of the locations inside the image that belong to each shape. You would use theAreaattribute to perform your filtering while you would use thePixelIdxListattribute to create a new output image and set these locations totruethat are within the desired area range: