Re: Automatic Segmentation of a region [message #29615 is a reply to message #29579] |
Tue, 05 March 2002 06:36   |
hradilv.nospam
Messages: 19 Registered: November 2001
|
Junior Member |
|
|
On Mon, 4 Mar 2002 13:59:39 -0000, "Martin Downing"
<martin.downing@ntlworld.com> wrote:
>
> "Akhila" <idlfreak@yahoo.com> wrote in message
> news:b1ad7b05.0203031342.226685ea@posting.google.com...
>> Hi,
>> I have a small problem in segmentation. I first threshold a image and
>> then i perform morphological operations on the binary image. Using
>> label_regions i've identified all the blobs. I used the where function
>> to get the regions in each blob. I have one huge blob and the rest are
>> small. I want to make all the pixels in the small blob as 0.
>> I tried the following:
>>
>> Method1:
>>
>> im = Origimage and morphimage
>> tv,image
>>
>
> I havent a clue how this would be what you want, try adding a comment to say
> what it should be doing
>
>> Method 2:
>>
>> for j = 1, noofblobs do begin
>> region = Where (morphimage eq j)
>> Area = n_elements(region)
>> if (Area le 80000) then begin
>> morphimage[region] = 0B
>> endif
>> endfor
>>
> refering also to:
>> ... I have one huge blob and the rest are
>> small. I want to make all the pixels in the small blob as 0.
>
> or to put it another way, you want everything but the large blob to be 0,
> and the large blob set to 1?
> this method is taken from working code
> ==============================
> ; threshold_image could be from an segmentation routine
> ;e.g.: threshold_image = image LT 100b
>
> label_im = label_region1(threshold_image)
>
> ; use histogram to count area of each labeled region (blob)
> area = histogram(label_im, min=0, binsize = 1))
>
> ; if you want just the blob of maximum area:
> max_area = max(area,max_label)
>
> ; now create a binary mask of the biggest blob
> big_blob = label_im eq max_label
>
> ; and display it
> tvscl, big_blob
I suspect that using tvscl (instead of tv) is the crux of the
problem?
> ======================
>
> hope this help you,
>
> cheers
>
> Martin
>
>
> ----------------------------------------
> Martin Downing,
> Clinical Research Physicist,
> Grampian Orthopaedic RSA Research Centre,
> Woodend Hospital, Aberdeen, AB15 6LS.
>
>
>
|
|
|