Welcome to iraf.net Wednesday, May 01 2024 @ 08:35 AM GMT


 Forum Index > Help Desk > General IRAF New Topic Post Reply
 Trimming overlap when combining images
   
will.flanagan
 05/19/2009 05:41PM (Read 4325 times)  
+----
Newbie

Status: offline


Registered: 04/25/2009
Posts: 6
Hi IRAFers,I have a question that is very basic but I can't figure out nonetheless:If you have a dither pattern of say 9 images (partially overlapping images) and you want to trim out the points that are in less than say 5 images - how would you do that? That is, I only want to combine the images where they overlap in at least 5 images, for example.Or simpler yet, what if I have to images and I want to trim both the images where they don't overlap...I've been looking at the imcombine and imcopy keywords, but haven't found what I'm looking for. You can assume that the images have good world coordinates to use for figuring out overlap.Cheers and thanks in advance for any comments!
-Will

 
Profile Email
 Quote
DAstronomer
 05/19/2009 05:41PM  
+----
Newbie

Status: offline


Registered: 05/14/2009
Posts: 2
Hia Will,Yep, there's a way to do it. Use IMALIGN and then IMCOMBINE. What I would do is read thru the help file and get familiar with it. There's a simple way to generate the shifts file: Use IMCOMBINE, with offsets="wcs". Make a dummy out list and ignore it, using only the text output generated. You can find the text output by simply using vi or vim (or whatever text editor you want) to look at the logfile. Name it something obvious and grab the shifts from it. Save the shifts as your new shifts file for IMALIGN.And when I think about it, you don't have to ignore the outputted files. You can check your output from IMCOMBINE against the output from IMALIGN+IMCOMBINE and see how closely they agree.IMALIGN does require reference coords (in pixel coordinates). These don't need to be very accurate; within 3 pixels is ok. Choose 3-5 stars that are common to each image and put their coordinates into a file called "whatever.coord". Now you have your reference image (the first image on the input list, the one that the stellar coordinates are derived from), your coords file (with the stellar coords), and you're now set. The keywords to set is trimimages=yes & shifts="shiftsfile" (whiere shiftsfile is a file with the offsets from the first run of IMCOMBINE).This will trim the input images to only the areas that are common to all of the images. After running IMALIGN, run IMCOMBINE again, this time with the offsets="none". This will output your final, trimmed image.This is a little roundabout, but it goes quickly after a few practice rounds :-)
Cheers,
-DAstronomer

 
Profile Email
 Quote
will.flanagan
 05/19/2009 05:41PM  
+----
Newbie

Status: offline


Registered: 04/25/2009
Posts: 6
First off - Thanks DAstronomer!Second - I was also wondering if there are any more automatic ways to do it since I need to do this to ~1000 images. All of the images have good world coordinates to begin with so specifying pixel/coordinate inputs for various stars in each image seems redundant.I appreciate any input - Thanks!
Will

 
Profile Email
 Quote
valdes
 05/19/2009 05:41PM  
+++++
Active Member

Status: offline


Registered: 11/11/2005
Posts: 728
Hello Will,It is true that imcombine is designed to give you the maximum image that contains all the input data; i.e. the union. What I guess you want is the intersection and imcombine doesn't provide this though I think I thought about this once.You comment about a criterion such as "at least five images overlapping" points me to the idea of using the output of imcombine that gives you the number combined in some way. However, the only easy thing I can think of is to use it to set all pixels with too few contributions to some number (with imexpr). How to then find the rectangular border containing the remaining data is not clear though it would be possible to write a script. The IRAF way would be to somehow generate an image section string, then a simple imcopy with the section concatenated to the image would do the trimming. But I don't see a simple way to compute the section. It would possibly be done by taking projections (collapsing the image or the number combined mask) to 1D along x and y, dump the values to text with listpix, and have a loop that goes from each end to the point where are enough pixels, and finally use the variables to create the section string.A question is why you need the image trimmed. If it is to save space then you do need to trim. But if it is to run an application that only considers data with sufficient overlap then maybe the application can make use of masks or can exclude data with values below or above some threshold (i.e. apply the mask with imexpr to set the image values to some magic value such as zero of -1000, etc.)I hope this helps.Yours,
Frank Valdes

 
Profile Email
 Quote
Arp
 05/19/2009 05:41PM  
++---
Junior

Status: offline


Registered: 06/15/2009
Posts: 34
Hi Will!Did you found a solution? Because I have to do this too for about 400 images. But I dont care how many images overlap...But I have mosaics, not dithered images. And such a mosaic is, depending on the imaged fields, not rectangular.

 
Profile Email
 Quote
   
Content generated in: 0.12 seconds
New Topic Post Reply

Normal Topic Normal Topic
Sticky Topic Sticky Topic
Locked Topic Locked Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Anonymous users can post 
Filtered HTML Allowed 
Censored Content 
dog allergies remedies cialis 20 mg chilblain remedies


Privacy Policy
Terms of Use

User Functions

Login