comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: How to eliminate smaller blob from label_region image
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: How to eliminate smaller blob from label_region image [message #77347 is a reply to message #77346] Mon, 22 August 2011 01:13 Go to previous messageGo to previous message
Wout De Nolf is currently offline  Wout De Nolf
Messages: 194
Registered: October 2008
Senior Member
On Sun, 21 Aug 2011 22:40:24 -0700 (PDT), vijay s
<vijayans.in@gmail.com> wrote:

> hi all,
>
> I used label_region to get individual blob id for each region.
> But few of my blobs are very small in area wise and
> i want to eliminate those from my images and retain blobs of larger
> area (say pixel area gt 10). How can i eliminate unwanted smaller
> blobs?
>
>
> thanks in advance.


By using the HISTOGRAM function:


; Minimum number of blob pixels
npix_threshold=10

; Get image
path=FILEPATH('pollens.jpg',SUBDIR=['examples','demo','demod ata'])
READ_JPEG, path, image

; Get blob indices
b = LABEL_REGION(image gt 150)

; Get population and members of each blob
h = HISTOGRAM(b, REVERSE_INDICES=r)

; Regions with small number of pixels
ind = where(h lt npix_threshold,ct)

; Remove the small regions
for i=0l,ct-1 do b[r[r[ind[i]]:r[ind[i]+1]-1]]=0


Obviously, some indices will be missing since you zero'ed them out.
You might want to fix that. It might not even be necessary to set the
small blob indices to zero. It all depends on what you will do with
the blob indices.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: ackermann number
Next Topic: Finding a large number of files - ls vs file_search?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 01:18:44 PDT 2025

Total time taken to generate the page: 0.55969 seconds