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

Home » Public Forums » archive » Grayscale AND Binary Image
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Grayscale AND Binary Image [message #29577] Wed, 06 March 2002 22:33 Go to next message
idlfreak is currently offline  idlfreak
Messages: 47
Registered: October 2001
Member
HI,
I have an image that's greyscale and i performed thresholding and
morphological operations on that image. When i try to perform AND
operation on the greyscale and this binary image obtained after
processsing, i don't get a clear output. With the binary image that is
processed I should be able to obtain the same region in the grayscale
image.


The original grayscale image can viewed at

http://www.geocities.com/r_akhila/original.jpg

The (binray)threshholded image can be viewed here
http://www.geocities.com/r_akhila/thresholded.jpg

The original AND thresholded image can be viewed here
http://www.geocities.com/r_akhila/final.jpg

Please tell me how to do that.

Thanks in advance for any help.

Cheers,
Akhila
Re: Grayscale AND Binary Image [message #29683 is a reply to message #29577] Mon, 11 March 2002 07:41 Go to previous message
Dick Jackson is currently offline  Dick Jackson
Messages: 347
Registered: August 1998
Senior Member
"Alex Schuster" <alex@pet.mpin-koeln.mpg.de> wrote in message
news:3C8C87B9.AB9F06DC@pet.mpin-koeln.mpg.de...

> And the indices _are_ already there, they are in the index array. If you
> need them as coordinates, you can calculate them like this:
>
> x_coord = index mod x_dim
> y_coord = index / y_dim

That may be a typo. In this kind of calculation, you would usually have:

y_coord = index / x_dim
^
Cheers,
--
-Dick

Dick Jackson / dick@d-jackson.com
D-Jackson Software Consulting / http://www.d-jackson.com
Calgary, Alberta, Canada / +1-403-242-7398 / Fax: 241-7392
Re: Grayscale AND Binary Image [message #29686 is a reply to message #29577] Mon, 11 March 2002 02:32 Go to previous message
Alex Schuster is currently offline  Alex Schuster
Messages: 124
Registered: February 1997
Senior Member
Akhila wrote:

>> For example, instead of
>>
>> new_img = original_img * mask_img
>>
>> you can do it that way:
>>
>> index = where( mask_img eq 1 )
>> new_img = 0 * original_img
>> new_img[index] = original_img[index]
>>
>> or:
>>
>> index = where( mask_img eq 0 )
>> new_img = original_img
>> new_img[index] = 0
>>
>> Alex

> yes. i want to get the indices of the pixels in the
> masked region and plot them in the original image.
>
> The idea you had suggested does the same thing as *

Correct, it was just indended as an example for where().

> i'm not sure if i can get the indices only (pixel
> location and not the value of the pixel) in a variable
> and then use those values to mask the original image
> and set the values of rest of the pixels to 0 in the
> original image.
>
> I hope i'm clear this time.

Sorry, I still don't understand. Why doesn't the code above already do
what you want?
And the indices _are_ already there, they are in the index array. If you
need them as coordinates, you can calculate them like this:

x_coord = index mod x_dim
y_coord = index / y_dim

Alex
--
Alex Schuster Wonko@planet-interkom.de
alex@pet.mpin-koeln.mpg.de
Re: Grayscale AND Binary Image [message #29704 is a reply to message #29577] Fri, 08 March 2002 12:45 Go to previous message
idlfreak is currently offline  idlfreak
Messages: 47
Registered: October 2001
Member
yes. i want to get the indices of the pixels in the
masked region and plot them in the original image.

The idea you had suggested does the same thing as *

i'm not sure if i can get the indices only (pixel
location and not the value of the pixel) in a variable
and then use those values to mask the original image
and set the values of rest of the pixels to 0 in the
original image.

I hope i'm clear this time.

Thanx for ur time.

-Akhila.


Wonko@netcologne.de (Alex Schuster) wrote in message news:<8KOj1SOed8B@netcologne.de>...
> idlfreak@yahoo.com (Akhila) wrote:
>
>> I have the same size window for both the images. Is there any way
>> that i can get the region(pixel value) from the binary image and
>> obtain the same pixels in the original image. If that's possible
>> it'd be more ideal as that's the result i want.
>> Help me please !!!
>
> I'm not sure what you mean... do you want to get the indices of the
> pixels which are set to 1 in your mask image? Then have a look at the
> WHERE() function.
>
> For example, instead of
>
> new_img = original_img * mask_img
>
> you can do it that way:
>
> index = where( mask_img eq 1 )
> new_img = 0 * original_img
> new_img[index] = original_img[index]
>
> or:
>
> index = where( mask_img eq 0 )
> new_img = original_img
> new_img[index] = 0
>
>
> Alex
Re: Grayscale AND Binary Image [message #29715 is a reply to message #29577] Thu, 07 March 2002 14:23 Go to previous message
Wonko[2] is currently offline  Wonko[2]
Messages: 6
Registered: March 2002
Junior Member
idlfreak@yahoo.com (Akhila) wrote:

> I have the same size window for both the images. Is there any way
> that i can get the region(pixel value) from the binary image and
> obtain the same pixels in the original image. If that's possible
> it'd be more ideal as that's the result i want.
> Help me please !!!

I'm not sure what you mean... do you want to get the indices of the
pixels which are set to 1 in your mask image? Then have a look at the
WHERE() function.

For example, instead of

new_img = original_img * mask_img

you can do it that way:

index = where( mask_img eq 1 )
new_img = 0 * original_img
new_img[index] = original_img[index]

or:

index = where( mask_img eq 0 )
new_img = original_img
new_img[index] = 0


Alex
--
Alex Schuster Wonko@netcologne.de PGP Key available
alex@pet.mpin-koeln.mpg.de
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: IDL on mandrake 8
Next Topic: Re: CALL_EXTERNAL and memory allocation

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

Current Time: Fri Oct 10 11:33:09 PDT 2025

Total time taken to generate the page: 0.32079 seconds