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

Home » Public Forums » archive » Re: subset an image by coordinates
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: subset an image by coordinates [message #68061 is a reply to message #68053] Mon, 21 September 2009 07:51 Go to previous messageGo to previous message
Alvaro Paredes L. is currently offline  Alvaro Paredes L.
Messages: 5
Registered: September 2009
Junior Member
On 20 sep, 22:27, Jeremy Bailin <astroco...@gmail.com> wrote:
> On Sep 20, 1:00 pm, "Alvaro Paredes L." <alvaropared...@gmail.com>
> wrote:
>
>
>
>
>
>> On 20 sep, 10:24, Robert <robert.m...@gmail.com> wrote:
>
>>> On Sep 20, 8:12 am, Jeremy Bailin <astroco...@gmail.com> wrote:
>
>>>> On Sep 19, 11:14 pm, "Alvaro Paredes L." <alvaropared...@gmail.com>
>>>> wrote:
>
>>>> > Hi all
>
>>>> > I was searching on the web, but i didn't find an answer to my problem.
>>>> > I need to make asubseton animageusing
>
>>>> > coordinates, but i can't find a way to do it. I see this method
>
>>>> > http://groups.google.es/group/comp.lang.idl-pvwave/browse_fr m/thread/...
>>>> > and this other (very
>
>>>> > similar) http://www.mombu.com/programming/idl/t-subset-an-image-by-ro i-in-idl-...,
>>>> > but don't use
>
>>>> > coordinates, use an evf file.
>
>>>> > IDL/ENVI has a widget that use only two coordinates to cut (upper-left
>>>> > and lower-right coordinate), but it isn't
>
>>>> > fully automatically.
>
>>>> > Is there any function to cut theimagewith set coordinates and save
>>>> > it in a new file?
>
>>>> > I really hope you can help me... I'm not a programmer and this
>>>> > sometimes it's very hard
>
>>>> > Thanks!
>
>>>> > Alvaro
>
>>>> Do you mean like:
>
>>>> newimage = oldimage[x0:x1,y0:y1]
>
>>>> ?
>
>>>> -Jeremy.
>
>>> If the original author is looking tosubsetby map coordinates, he
>>> needs to use the procedure
>
>>> ENVI_CONVERT_FILE_COORDINATES, FID, XF, YF, XMap, YMap
>
>>> to convert the corners of hisimagein map coordinates to file
>>> coordinates. Once he has the proper file coordinates, he cansubset
>>> theimage. If you give us a little more specifics of what you are
>>> trying to do, we can probably provide more information.
>
>>> r
>
>> Thanks for the quickly help. I have animagewith degrees coordinates
>> and with the function that Robert suggested
>> (ENVI_CONVERT_FILE_COORDINATES) i can transform coord to pixel value
>> without problems (as the script i show below). But i try to do that
>> Jeremy suggest, but i don't know if is it properly working
>> (image=img_file[XF,YF]??)
>
>> forward_function ENVI_CONVERT_FILE_COORDINATES
>> proSUBSET
>> envi, /restore_base_save_files
>> envi_batch_init,log_file='batch.txt'
>
>> ; define theimageto be opened
>> img_file='F:\IMAGE\NDVI-HDF\try\NDVI_2008_03_02.img'
>> envi_open_file,img_file,r_fid=fid
>> print, 'fid=',fid
>
>> ; define coordinates to make thesubset
>> YMap=[-32.6030694, -32.9797194]
>> XMap=[-71.0580916, -70.5006694]
>
>> ENVI_CONVERT_FILE_COORDINATES, FID, XF, YF, XMap, YMap
>
>> ;rounds the pixel value to its closest integer.
>> XF=ROUND(XF)
>> YF=ROUND(YF)
>
>> ;verify the conversion
>> print, 'X pixel ',XF
>> print, 'Y pixel ',YF
>
>> ;making thesubset??????
>> image=img_file[XF,YF]
>
>> ; Exit Envi
>> envi_batch_exit
>> end
>
>> Finally, and maybe this is a basic question, how i save this "subset"
>> in a .img file?
>
>> Thanks!
>
>> Alvaro
>
> Note the colons in my example. :-)=  Instead of
>
>  image=img_file[XF,YF]
>
> you probably want:
>
>  image=img_file[XF[0]:XF[1], YF[0]:YF[1]]
>
> -Jeremy.

Well, thanks Jeremy. I tried to do what you say but i obtain this
error:
"Subscript range values of the form low:high must be >= 0, < size,
with low <= high: IMG_FILE."

I have verified the order min:max in [XF[0]:XF[1], YF[0]:YF[1]], and
try with manual input of pixels values, and isn't working... there's
something i'm doing bad... :(

Alvaro.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Structure
Next Topic: structure

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

Current Time: Sat Dec 06 05:30:29 PST 2025

Total time taken to generate the page: 0.01473 seconds