220 likes | 417 Views
Image Resampling. ASTR 3010 Lecture 21 Textbook 9.4. Why do we need to resample?. Display – transform image into ‘standard’ form Undo warps and distortions Transform to standard frame Resizing: upsampling or downsampling Rotation
E N D
Image Resampling ASTR 3010 Lecture 21 Textbook 9.4
Why do we need to resample? • Display – transform image into ‘standard’ form • Undo warps and distortions • Transform to standard frame • Resizing: upsampling or downsampling • Rotation • Image comparison – transform one image to match another • Mosaicking • Building sky region and all sky images • Image arithmetic • Dither additions, image differencing, speckle analysis from Tom McGlynn’s IPAM Workshop presentation
Resamplingexample SkyView transforms the EGRET all sky map in Galactic coordinates to Equatorial coordinates.
Nearest Neighbor Nearest neighbor assignment is the resampling technique of choice for discrete data since it does not alter the value of the input cells. However, astrometric accuracy is degraded. gray grid: input grid orange: nearest neighbor in the input red: output value
Bilinear interpolation Bilinear interpolation is done by identifying the four nearest cell centers on the input raster (in orange) and assigning itself to the weighted average of the four values. This process is repeated for each cell in the output raster.
Bilinear interpolation • A common method for resampling images a b
Cubic interpolation by identifying the 16 nearest cell centers on the input raster (in orange) and assigning itself to the weighted average of the 16 values.
Example of 4x Upsampling Nearest neighbor Original Bilinear Bicubic
Interpolation smoothes out features Original Signal 0.5 pixel shifted and Linear interpolated resampled x3 shifted and interpolated
Resolution enhancement (or Super-Resolution) • Nearest Neighbor degrades positional information • Bilinear (or other low order interpolations) smooth the signal • Three commonly used resampling strategies • Shift-and-add (and interpolate) • Interlace • Drizzle
Shift-and-add input grid output grid
Shift-and-add fractional contribution from an input pixel to several output pixels output grid
Shift-and-add fractional contribution from an input pixel to several output pixels output grid
Interlace input grid output grid
Interlace examine each input pixel. locate its transformed center in the output grid. assign ALL input pixel count to a corresponding output pixel (no fractional coordinates) Repeat this process for many input images with known dithers super-resolution
Interlace 1D example: Python HW#5 • Four samplings of a double Gaussian-peak distribution. • Each sampling was shifted (“dithered”) with +0.25 pixels to the right. sample1=[0.39,38.92,26.39,34.27] sample2=[3.39,42.92,38.20,15.50] sample3=[12.02,36.63,46.63,4.72] sample4=[26.32,27.30,45.54,0.80] • Construct an interlaced distribution showing a 4 times better resolution.
Problems and Limitation • Interlace for a single image is a flawed approach: • it creates a discontinuous image • positional error b/c we ignore any fractional coordinates • with many input images, these two problems will become less significant. • Shift-and-add and Interlace methods both require precise information on “shift” between images • Limited precision of many actual telescope controls usually produces a set of images whose grids are randomly dithered at the sub-pixel level not suitable for S&A and interlace.
Drizzle (variable-pixel linear reconstruction) input drop input grid output grid
Drizzle p f=d/p f0 interlace f1 shift and add d empty output pixel input grid output grid In Pyraf, pydrizzle is available by “import pydrizzle”
Drizzle Example • M57 • left (original image) right (2x drizzle with 100 input images)
In summary… Important Concepts Important Terms • Resampling • shift-and-add • interlace • drizzle • Chapter/sections covered in this lecture : 9.4