Remove small objects from binary image without erode.

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
Ironic
12/16/2009 12:17:03 AM
comp.soft-sys.matlab 207303 articles. 1 followers. lunamoonmoon (258) is leader. Post Follow

5 Replies
2412 Views

Similar Articles

[PageSpeed] 39
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
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
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
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
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
Simone
4/13/2010 2:00:26 PM
Reply:
Similar Artilces:

How do I make an Image visible?
Hi, I have the following code: <script> LeftCurtain=new Image(midPoint,ht); LeftCurtain.src="images/black.gif"; LeftCurtain.left="0px"; LeftCurtain.top="0px"; LeftCurtain.visibility="visible"; </script> Nothing appears. Not in Firefox, Opera or IE7. Can anyone let me know what's wrong? On Sep 30, 3:31 pm, Cov <dcoven...@hotmail.com> wrote: > Hi, > > I have the following code: > <script> What type of script is this? > LeftCurtain=new Image(midPoint,ht); Where are these two parameters defined...

How to remove an interface from spanning tree?
Hello folks We have a triangle shaped L2 network with three 6513 switches and spanning tree enabled on all vlans to handle loop configuration. Pretty basic I guess. Today the fiber link between our root 6513 and the "secondary" 6513 went down due to supplier error, but everythings OK using the other links previously blocked by STP and I disabled the interfaces on the broken link not to confuse STP if the link comes up. Now our supplier tells us to start testing the link but I don't want to risk STP sync during office hours. Is there a way to bring up an L2 interface without part...

Add small, isolated regions to a selection
When dealing with a scan of a text document, the following problem often appears: Using the color selection tool most of the white and lightgray background can be selected---with the exception of small isles of dirt which have almost the same color as the text. My question: Is there any extension (plugin, LISP-code) to gimp which can collect all isolated regions up to a certain area outside the selection and add them to the latter? + what you want here is "fuzzy select", which, just as you describe, selects according to a range, rather than a single color, which can be set by th...

RFD: Remove comp.soft-sys.nextstep
REQUEST FOR DISCUSSION (RFD) This is a formal Request For Discussion (RFD) to remove the following Usenet newsgroup: remove comp.soft-sys.nextstep RATIONALE: remove comp.soft-sys.nextstep This is one of a set of 31 low-traffic former INET groups proposed for removal. Please see the article "2nd RFD: Remove low traffic former INET groups" posted to news.announce.newgroups and news.groups for a more general discussion. ********************************************************************************** RATIONALE: remove comp.soft-sys.nextstep The newsgr...

Removing language comparisons
python.org has a page of "Python vs. X" language comparisons at <http://www.python.org/doc/Comparisons.html>. They're all pretty outdated, and often unfair because they're written by a person who knows Python well but has only a nodding acquaintance with language X. I'm planning to drop this page from python.org because it's so outdated and no one is around to maintain it. If anyone wants to grab the contents and turn them into a Wiki page, or use bits of them for marketing material, please do it now. --amk On Wed, 20 Aug 2003 20:51:30 -0500, "A.M. K...

[JavaScript] 2 action for an image map
Hello. We're currently working on a project and we're supposed to make a system that is supposed to create a square on a image map when the mouse passes over a person (our project is to generate an album photo) and write person's name under the square. Actually, we only have the square, as you can see : http://www.mokoenashack.com/?v=d5SD6W.png We're supposed to have something like this: http://www.mokoenashack.com/?v=PCAhIR.png But we don't know how to put the name under the square depending of the image map's coordinate. Is someone can help us ? If our english i...

Re: removing string from text files.
Hello I need to extract data from text file, which contain random text at a regular interval. My text file looks something like this: 2.00 'day' 2000-01-03 'Global Mole Fraction(SOL) - Matrix' '' 0.850421 0.662334 0.42014 0.304977 0.19464 0.107398 0.0579599 0.0352883 0.0235352 0.0138323 0.00822029 0.00476013 0.00218838 0.000692394 0.000261295 0.000107044 4.26836E-005 4.00 'day' 2000-01-05 'Global Mole Fraction(SOL) - Matrix' '' 0.949048 0.872466 0.744197 0.653951 0....

Method 'Form' of object '_SubForm' failed
This has really been my day for wierd problems sorting one of my forms (a subform actually)... so here's another one. I am now receiving the following error Run-time error '-2146500594 (800f000e)': Method 'Form' of object '_SubForm' failed The code breaks on the first line of the following section of code: With Forms!frmInventory![Auto Parts].Form .OrderBy = "fldPartInvNo" .OrderByOn = True End With Now...the wierd part is that this code was working perfectly for the l...

Convert String to Object
Hello all, I am trying to convert a myString declared as a String[] and convert it into an Object so that I can use the non static method. Currently, my program does not compile. The error I'm receiving is my old friend error msg: "non-static method setData....cannot be referenced from a static content. Essentially, I want to read in an array of Strings into objects for data manipulation (a sort to be exact.). The program looks something like this: .... public void init (String[] array, int size){ ..// assume array[0] is the first string read in from the text file String dataSt...

pthread semaphore a kernel object?
I'm from the Win32 world, so please pardon my questions if they seem elementary. I've been told that semaphores on Unixes (except Solaris) and Linux have very heavy kernel objects and there are only a limited number on a system so it's wise not to overuse them. I've got a multithreaded app running on RedHat 6.2 and uses pthreads. My question is, what are the differences between pthreads' semaphores and Sys V semaphores in regards to what I've been told? I have several blocking queues that uses pthreads semaphores in my app. I need to know if I am hogging to...

Remove interior points from convex hull.
Hi, I am using CGAL 3.3 for incremental construction of convex hull in higher dimensions. I was wondering if there is a quick way to remove redundant points (points that are not vertices of the hull) from the Convex hull in d dimensions in CGAL? I could of course do it by deleting the old hull and constructing a new one from scratch with only the points that are vertices of the old hull. But this may not be so efficient. I need this since I incrementally add points to the convex hull, and would like to save memory space by removing points that lie in the interior. thanks, amit. A po...

URL-Link in a maple-worksheet should download a jpg-image on a website
Hi, an URL-Link in a maple-worksheet should download a jpg-image on a website and open it inside the worksheet when I execute the worksheet. Is there a way to do this? Thank you ...

remove background of an image
Hi, I,m trying to analyze an Image statistical, i.e. getting contrast= std/mean, I need a correct result, and may another way to analyze this image, and I need to remove background...., may be use fft2,pdf and smoothing...... the image is "speckle pattern", I used the webcamera to get this image, it's with a squared black background say 8cmx8cm and the speckle spot in the middle is with a diameter 5 cm I did this, I =double(imread(image.jpg'))=; II=1/3*(I(:,:,1)+I(:,:,2)+I(:,:,3)); contrast=std(std(II))/mean(mean(II)); appricate if someone can help me.... thanks ...

understanding wavelet transform in image processing....
Dear Forum, I am learning about wavelets and image processing. I have seen how the wavelet transform of an image looks like: it is a bunch of subimages that seem low pass and high pass filtered versions of the original image.... That is not what I expected the wavelet transform to look like after studying the continuous one-dimensional wavelet transform, which represents the coefficients of the various wavelets once the mother wavelet is chosen.... Does anyone have any hint on how to interpret the wavelet transform of an image and all its subimages? Is each of those filtered ...

Problems after removing from domain
Removed an XP Pro box from a domain into a workgroup and now it will restart 2 to 3 times a day, the message is: "Shutdown was initiated by NT AUTHORITY\SYSTEM C:\Windows\ System32\services.exe Status code-1073741819" which is an access violation. Is there anyone that knows a fix for this, not sure if a domain policy is trying to still run or a service. TIA Tim ...

Image Data
How to understand the value of Image Data that read from picture file? &nbsp; Use the 'Draw flattened pixmap.vi' function in Block diagram&gt;&gt;functions Palette &gt;&gt; graphics and sound&gt;&gt; picture functions and convert the image data to display as an Image see attached pic/ VI regards Dev image data to image.JPG: http://forums.ni.com/attachments/ni/170/197234/1/image data to image.JPG read jpeg pic data.vi: http://forums.ni.com/attachments/ni/170/197234/2/read jpeg pic data.vi Dear Devchander &nbsp; Thank for your reply and VI. I&...

Reading binary data
Hello, I try to read binary data from an SD-card and put into a data array. There are some different data types: float32, int32, uint32, int16, uint16, int8, uin8. If 3211 sectors are read, then the array should look like 3122x84 (84 different values and data types). One complete data record is 256 bytes. I�ve tried to work with "fread" but I don�t know how to get this structure. Thanks in advance - greetings from Germany Udo ...

Couple of small queries
Hi, I have two (hopefully) simple queries about the following proposed table definition : mysql> describe charges; +---------------+----------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+----------------------+------+-----+---------+-------+ | model_no | smallint(4) zerofill | NO | PRI | 0000 | | | pro_hour | decimal(10,2) | NO | | 0.00 | | | pro_half | decimal(10,2) | NO | | 0.00 | | | pro_day | decimal(10,2) | NO ...

removing a namespace prefix and removing all attributes not in that same prefix
Hi, After reading and experimenting for a several hours, I have this stylesheet: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xmlns="http://www.w3.org/2000/xmlns/" xmlns:mathematica="http://www.wolfram.com/XML/" version="1.0"> <xsl:template match="mml:*"> <xsl:element name="{local-name(.)}" namespace="{namespace-uri(.)}"> <xsl:for-each select="...

Removing Text W/O Removing Background
I scanned a document with photos and text. I need to change some of the text but don't know how to with out cutting the whole background out. I tried to use the clone tool and spot healing brush but they don't seem to work. Part of the text has a white background and part of it has an image underneath it. How do I edit this text without changing the background? Thanks, Mick "mkaywood@stu.parkland.edu" <mkaywood@stu.parkland.edu> wrote in news:1142534318.563137.241780@z34g2000cwc.googlegroups.com: > I scanned a document with photos and text. I need to change som...

Biblatex, removing comma before pageref and adding parenthesis
Hi All, I am trying to tweak Biblatex to adhere to the MHRA style. I therefore need a journal citation to look like this: > Author, 'Title', [i]Journal[/i], Volume (Date), pages (p./pp. pageref). At the moment the best I can get is almost right. I get: > Author, 'Title', [i]Journal[/i], Volume (Date), pages, p./pp. pageref. So what I need to do is get the pageref to be in parentheses, and get rid of the comma before it. I thought that this would work, but it does not: \DeclareFieldFormat{pagerefincollection}{\mkbibparens{#1}} \newbibmacro*{pagerefincollection}{% ...

image & video problem #2
hi, i have used video input to my code, change to image type (show in code) and do transformation with the input. at the end, i want to convert back the transformation as a video. i can view the image by frame using imview. but when i do imread (beccasue i am trying to get frame.. it give error and i cannot make it as video output again. can somebody give any guide. this is my code. : TQ for any attention : function dct3d close all; %% video input clear data disp('input video'); avi = aviread('samplevideo.avi'); pixels = double(cat(4,avi(1:2:end).cd...

Autoconvert object from one class1 to other class2 in class1 def
Is it possible to convert from one Class1 to another Class2 within the functions of the Class1? Example: class String def to_i! self=self.to_i end end c='1' # c='1' - String c.to_i! # c=1 - Integer Previous code is wrong, error: Can't change the value of self self=self.to_i -- Posted via http://www.ruby-forum.com/. or how get name of variable in class method? I mean that may be: class String def to_i! # i don't know what is real name of this method (get_name_of_variable) name=self.get_name_of_variable eval("#{name}=#{name}.to_i") end e...

Remove Duplicates #2
V8.03 Approx 690,000 records 10 Fields 1 Field Unique Field-Called Global How to revove duplicate row entries in the database. Thanking all in advance Ron roncayne On 6 Jul 2006 17:51:27 -0700, roncayne@gmail.com wrote: > V8.03 > Approx 690,000 records > 10 Fields > 1 Field Unique Field-Called Global > How to revove duplicate row entries in the database. > Thanking all in advance For that many records the fastetst solution would be - export as tab separated text to '803.txt' - type the unix command 'sort -u 803.txt > 803.tab' - import 803.tab to ...

Microsoft
"Summary: So, the OEMs make money from installing crapware onto PCs, and now Microsoft is making money removing it. Makes you realize why more and more people are buying Apple hardware." "So far, Signature has been limited to new PCs. But now, Microsoft will offer customers the opportunity to give their Windows 7 PC the Signature treatment by bringing it to a Microsoft Store and paying $99, according to the Wall Street Journal" http://www.zdnet.com/blog/hardware/microsoft-to-charge-customers-99-to- remove-oem-crapware/20446 http://tinyurl.com/7u73wcr Note that in r...