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 
Return to the default flat view Create a new topic Submit Reply
Re: Grayscale AND Binary Image [message #29686 is a reply to message #29577] Mon, 11 March 2002 02:32 Go to previous messageGo 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
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
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: Sat Oct 11 22:34:27 PDT 2025

Total time taken to generate the page: 0.88205 seconds