Remove small objects from binary image without erode.

  • Permalink
  • submit to reddit
  • Email
  • Follow


Is there a function that removes objects binary image based only on their pixel area?

I want to maintain lines, so erode or close is out of the question. Planning on using region props and check each area region, but that seems slow and inefficient...

Tks
0
Reply Ironic 12/16/2009 12:17:03 AM

See related articles to this posting


On Dec 15, 7:17=A0pm, "Ironic Prata" <lixodoiro...@hotmail.com> wrote:
> Is there a function that removes objects binary image based only on their=
 pixel area?
>
> I want to maintain lines, so erode or close is out of the question. Plann=
ing on using region props and check each area region, but that seems slow a=
nd inefficient...
>
> Tks
---------------------------------------------------------------------------=
---------------------------------------------------------------------------=
------------------------------------
You can use bwareaopen().  Despite the name it doesn't use a
morphological opening, but rather uses the regionprops method, that
you want to avoid.  I don't know of any faster methods.  Why do you
say it's slow?  It doesn't seem slow when I use it - just takes a
fraction of a second.  How large are your images, how many blobs are
in them, and how long is it taking on your computer?  Maybe you can
get a faster computer.
0
Reply ImageAnalyst 12/16/2009 1:35:59 AM

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <99896c54-e824-4fc6-9b92-3eb8fa8c7704@x20g2000vbn.googlegroups.com>...
> On Dec 15, 7:17?pm, "Ironic Prata" <lixodoiro...@hotmail.com> wrote:
> > Is there a function that removes objects binary image based only on their pixel area?
> >
> > I want to maintain lines, so erode or close is out of the question. Planning on using region props and check each area region, but that seems slow and inefficient...
> >
> > Tks
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> You can use bwareaopen().  Despite the name it doesn't use a
> morphological opening, but rather uses the regionprops method, that
> you want to avoid.  I don't know of any faster methods.  Why do you
> say it's slow?  It doesn't seem slow when I use it - just takes a
> fraction of a second.  How large are your images, how many blobs are
> in them, and how long is it taking on your computer?  Maybe you can
> get a faster computer.

the problem is that this is to be used in a loop, so i want efficiency.

but at least that function will clear up the code. tks
0
Reply Ironic 12/16/2009 2:28:03 AM

On Dec 15, 9:28=A0pm, "Ironic Prata" <lixodoiro...@hotmail.com> wrote:
> the problem is that this is to be used in a loop, so i want efficiency.
> but at least that function will clear up the code. tks
---------------------------------------------------------------------------=
----------------------
You're implying that the bwareaopen function is inefficient.  What's
the basis for saying that?  Do you have a more efficient method?  Why
is this method too slow for you?  Again, what kind of speed do you
require and what kind of speed are you getting?

0
Reply ImageAnalyst 12/16/2009 2:54:06 AM

Hi

Other possibility, aside the suggestion made by ImageAnalyst, is to use a small median filter. You can "efficiently" apply it multiple times in a loop.

Igor 

"Ironic Prata" <lixodoironic@hotmail.com> wrote in message <hg98tv$2m$1@fred.mathworks.com>...
> 
> Is there a function that removes objects binary image based only on their pixel area?
> 
> I want to maintain lines, so erode or close is out of the question. Planning on using region props and check each area region, but that seems slow and inefficient...
> 
> Tks
0
Reply Novae 12/18/2009 4:54:04 PM

"Ironic Prata" <lixodoironic@hotmail.com> wrote in message <hg98tv$2m$1@fred.mathworks.com>...
> 
> Is there a function that removes objects binary image based only on their pixel area?
> 
> I want to maintain lines, so erode or close is out of the question. Planning on using region props and check each area region, but that seems slow and inefficient...
> 
> Tks

Like this:

stats = regionprops(binary, 'Area', 'PixelIdxList');
cleaned = binary;
for region = 1 : length(stats)
    if stats(region).Area < MIN_AREA
        cleaned(stats(region).PixelIdxList) = 0;
    end
end

I can guarantee this is REALLY fast! ;)
0
Reply Simone 4/13/2010 2:00:26 PM
comp.soft-sys.matlab 203516 articles. 531 followers. Post

5 Replies
1995 Views

Similar Articles

[PageSpeed] 37


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

How to remove small objects from binary images
I have a binary image containing many disconnected objects. What's the fastest way to remove objects whose pixel count is less than some threshold? At the moment I'm doing it by labeling the regions using bwlabel (image processing toolbox) and then looping through all the label values and finding out the pixel count of each one and then removing it if it's less than the threshold. This is slow and I need it to be fast because I'm doing this on each frame of a video. I thought about using an erosion technique but I don't want to erode the edges of any of the big objects. T...

removing large objects from a binary image
All, I'm wondering if anyone knows of a function or method to remove large objects from a binary image...what I want is something similar to bwareaopen, which removes images will less than a specified number of pixels, but in reverse. Thanks in advance for any help If nothing else I think you could subtract the bwareaopen from the original image and get only the larger ones... Daphne "Robert Maidhof" <rtm2001@columbia.edu> wrote in message <fub16i$jaf$1@fred.mathworks.com>... > All, I'm wondering if anyone knows of a function or meth...

removing large objects from a binary image #2
All, I'm wondering if anyone knows of a function or method to remove large objects from a binary image...what I want is something similar to bwareaopen, which removes images will less than a specified number of pixels, but in reverse. Thanks in advance for any help In article <fub16i$jag$1@fred.mathworks.com>, Robert Maidhof <rtm2001@columbia.edu> wrote: >All, I'm wondering if anyone knows of a function or method >to remove large objects from a binary image...what I want >is something similar to bwareaopen, which removes images >will less than...

removing an object from an image
As above, is there code about that, for example, removes a sheep from a field and replaces it with the grass around it. IE compares pixels with others and replaces them to create desired effect. cheers Nick In article <ef18bbb.-1@webx.raydaftYaTP>, nick <nky_84@hotmail.com> wrote: > As above, is there code about that, for example, removes a sheep from > a field and replaces it with the grass around it. > > IE compares pixels with others and replaces them to create desired > effect. A tool that specifically finds sheep in a field might be interesting. Though i...

Remove small objects
How to remove small objects when is use from help bw2 = ismember(L, find([S.Area] >= P)); the errer occur from ismember.m please help me ...

Removing objects in an image
Hi Im new to Matlab, i hope some one could help me. I have an image which has musical notes in which i have to remove the staff lines & show only the staff notes. lease some help me out? ...

Loading Objects without images
Hi! I was wondering whether I can load objects without their surface image-references. I converted a vrml file to LW 6 (couldn't find any other; I'm working with 7.5). And there are about 4000 objects that need to be loaded. Each has about 7 image references; so I'd really like to beware of clicking on "No" about 28000 times... I checked the LScript reference if there was a chance to avoid the "File not found..." messages, but I could not find any. Do you have any idea how to easily solve this problem? Thanks!!! "Samuel Sperling" <stop-S-P-A-Mb...

How to remove the small circle from Image?
Hello all: I have an image as follows: <http://danielmarkhot.googlepages.com/22019_bv.png> Can anyone give me some comments on how to remove those small circles? I would like to remove all circles from the image and only keep the curve left. Thank you in advance. -Daniel Use bwlabel function to locate each spot. Then for each of them calculate its eccentricity. If this value is below/above a threshold (and some addional thareshold about area) then consider/do no consider the object the undesired small circle. Matlab commands: - bwlabel - regionprops (to retrieve some additional i...

counting of objects from a binary image
I have converted a gray scale image to binary image which contains blood cells , I can count them manually , but I am not getting how to count them through program. sachin pande wrote: > > > I have converted a gray scale image to binary image which contains > blood cells , I can count them manually , but I am not getting how > to > count them through program. help bwlabel This will attach a number to each of the blobs in your image. Assuming that your bloodcells are the only blobs in the image, you could try Cell_Number = max(max(LabelImage)); If you have other blobs in ...

Removing small blobs from an image
How to remove small blobs from a RGB image? (suppose I want to remove the blobs with area less than 200). I was able to convert it into binary image and perform morphological processing but I dont want to convert it into binary image as I want the final image in RGB and not in binary format. Please help me. On Feb 2, 4:03=A0am, "Abhinay " <abhilab...@gmail.com> wrote: > How to remove small blobs from a RGB image? (suppose I want to remove the= blobs with area less than 200). I was able to convert it into binary image= and perform morphological processing but I dont wa...

Removing Unwanted objects from a image
Hi, Can anyone point me in the right direction to some tutorials, examples or programs where unwanted objects are removed from a image?. Is this kind of thing has already been carried out? Regards Peter ...

Radius of an object in binary image
Hi . . Can anybody help me to find a radius of an object just like what in this picture: http://s12.postimage.org/53cma00dp/image.jpg because i'm trying to find a radius for rectangle, triangle, circle or square by finding the max x-axis length and max y-axis length and then finding the mean. ...

Getting at the binary data in an Image object
I've search far and wide for an answer, so forgive me if this is a stupid question. (Well, it probably is.) Consider the following JavaScript: var foo = new Image(); foo.src = "http://some.server.com/some_filename.gif"; Now, the browser will retrieve 'some_filename.gif' from some.server.com and put it into the object foo. What I want to do is then subsequently analyze the actual binary data contained inside some_filename.gif. (Specifically, I just need to look at the first few bytes.) Is there any way to do this in just JavaScript? Thanks in advance for any assistance...

Determining Curvature of Objects in a Binary Image
I have a binary image with objects of various shapes in it. Now I need to seperate the nearly straight objects from other objects. Any ideas? I've been thinking of goodness of fit test. Any suggestions? Thanks, Nevine ...

help me to remove unwanted object from image
after using canny algo. for edge detection I found there are many other unwanted objects, so what can i do to live only the wanted object in the image. mufid wrote: > > > after using canny algo. for edge detection I found there are many > other unwanted objects, so what can i do to live only the wanted > object in the image. How do we know what features are important to you, and those you wish to discard? Without this information there is very little that can be done to help you. What you have to do is determine features that differ between the wanted objects and your 'no...

Crop an Image without changing it to Binary
I need to crop an object without changing the image into binary. I cannot crop the object manually by putting positions/co-ordinates. In my case, the object is a hand. Background is black and the hand is white. I need to crop out the hand without converting the image to binary. The RGB image is here: http://www.mediafire.com/?znwngzjydn3 Can anyone help me..? Find the edges of the hand somehow, for example when the summed profiles pass some threshold. verticalProfile = mean(imageArray, 2); horizontalProfile = mean(imageArray, 1); row1 = find(verticalProfile > thresholdval...

Associating objects in two binary images
Hi I have a relatively simple problem, but I am a beginning user of Matlab image processing, so bear with me. I have two binary images each with several objects. The number of objects in each image are similar but not exactly the same - but each object in one is associated with one or two objects in the other - the condition for association being that the smaller objects in one image are contained in or touching the larger objects in the other. Downstream of this, using these binary images as masks, I have to find the ratio or sum of...say, intensities, between associated objects. My que...

Convexity or concavity of binary image object
Hi! Does anyone know how to measure these two features in one object. I have already segmented it as a binary image object. best regards kreshnik How do you define a convexity of 0? Would that be a circle or a straight line? You should probably calculate the polar signature of the object and do some analysis on it. ...

Extend object in binary image around border
I have binary image with object inside non-uniform. I want to Extend the object in this binary image around object's border with 2 pixels. thanks for help On Sep 16, 10:12=A0am, "sinan naji" <sinann...@yahoo.com> wrote: > I have binary image with object inside non-uniform. I want to Extend the = object in this binary image around object's border with 2 pixels. > thanks for help ----------------------------------------------------------- Use imdilate() in the Image Processing Toolbox. ImageAnalyst <imageanalyst@mailinator.com> wrote in message &l...

In binary image can small holes only filled
I have a binary image, where there are lots of small holes and large holes. I don't know the locations of holes. I want to fill the small holes only. I have trieb bw2=Imfill(bw,1,'holes'); it makes the whole image white... bw2=Imfill(bw,4,'holes'); it fill up all the holes I have both small and large bw2=Imfill(bw,8,'holes'); it does not do anything So, is there any option in matlab to fill up the holes saying that I want to fill only small holes.size of my small holes are just a dot(small black dots in a white digit). and size of my big holes are '...

Assign binary stream to Image object
Hallo!! According to my previous post with popups hanging, now I'm trying to bypass this strange behaviour using loading JavaScript image not by image.src=URL but straight away from stream using HTTP GET method. The problem is, how to assign stream from downloaded image (ex. GIF89a) to a JavaScript Image object ? Below is my code with explanation what I'm trying to do: <script type="text/javascript"> var xmlhttp; /*@cc_on @*/ /*@if (@_jscript_version >= 5) var ids = ["Msxml2.XMLHTTP.5.0","Msxml2.XMLHTTP.4.0", "Msxml2.XMLHTTP.3.0",&qu...

help regarding filling objects in binary image
Dear friends, i have a binary image ( http://i41.tinypic.com/jj3hb6.jpg ) , i want to fill the left blob with RED and right blob with Green ( i mean pure red and pure green), i have tried for 6 hours but no luck , could you please help me ? thanks in advance ...

Image rotation without binary data file
Hi, I am trying to splot a surface and an image together on the same graph so t= hat they align, very similar to the first demo at <http://gnuplot.sourcefor= ge.net/demo/hidden2.html>, but with data instead of functions. I can do th= is with=20 splot 'image.txt' u ($1*2.1):($2*2.2):(0.0):3 matrix with image, 'surf_matr= ix.txt'=20 but am having no luck with re-positioning the image to align with the surfa= ce ( center=3D(0,0) ). The documentation and demos do this pretty easily = with binary data file types but .txt is not listed as a valid extension for...

Access compressed binary image (JPEG) without IMREAD
I have a Matlab program which simulates transmission of binary data over a wireless communications channel. I need to transmit an image (compressed JPEG) over the channel. When I load a JPEG using IMREAD, the loaded data occupies more memory than the original filesize (due to compression). E.g. the file "football.jpg" (in Matlab root) has a file size of 27130 bytes, but when loaded as: A=imread('football.jpg'); whos A; gives A occupying 245760 bytes (256 x 320 x 3). I can easily send the data in A through my channel simulator, but am wondering whether there is a way in whi...