Changeset 12588 for trunk/psLib/src/imageops/psImageUnbin.c
- Timestamp:
- Mar 26, 2007, 4:43:22 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/imageops/psImageUnbin.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/imageops/psImageUnbin.c
r11795 r12588 1 /** @file psImageUnbin.c 2 * 3 * @brief Functions to perform unbinning (resampling) of images. 4 * 5 * @ingroup Image 6 * 7 * @author Eugene Magnier, IfA 8 * 9 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2007-03-27 02:43:22 $ 11 * 12 * Copyright 2007 Institute for Astronomy, University of Hawaii 13 */ 14 1 15 #ifdef HAVE_CONFIG_H 2 16 # include "config.h" … … 4 18 5 19 #include <stdio.h> 6 7 20 #include "psError.h" 21 #include "psAssert.h" 22 #include "psRegion.h" 8 23 #include "psImage.h" 9 #include "ps Assert.h"24 #include "psImageBinning.h" 10 25 #include "psImageUnbin.h" 11 26 … … 15 30 // binned pixel. 16 31 // XXX check that this is still consistent with psphotImageMedian... 17 psImage *psImageUnbin(psImage *out, const psImage *in, int DX, int DY, int dx, int dy)32 psImage *psImageUnbin(psImage *out, const psImage *in, const psImageBinning *binning) 18 33 { 19 34 PS_ASSERT_IMAGE_NON_NULL(in, NULL); 20 35 PS_ASSERT_IMAGE_NON_NULL(out, NULL); 36 37 int DX = binning->nXbin; 38 int DY = binning->nYbin; 39 int dx = binning->nXskip; 40 int dy = binning->nYskip; 41 21 42 PS_ASSERT_INT_POSITIVE(DX, NULL); 22 43 PS_ASSERT_INT_POSITIVE(DY, NULL); … … 28 49 long Nx = out->numCols; 29 50 long Ny = out->numRows; 51 52 // XXX validate the binning structure vs the input and output images? 30 53 31 54 psF32 **vIn = in->data.F32; … … 183 206 * cases should be added 184 207 */ 185 double psImageUnbinPixel(const int ix, const int iy, // desired Unbinned point 208 double psImageUnbinPixel(const int ix, const int iy, // desired Unbinned point (parent coords) 186 209 const psImage *in, // binned image 187 const int DX, const int DY, //!< Scaling factors in x and y 188 const int dx, const int dy) //!< Overhang 210 const psImageBinning *binning) //!< Overhang 189 211 { 212 213 int DX = binning->nXbin; 214 int DY = binning->nYbin; 215 int dx = binning->nXskip; 216 int dy = binning->nYskip; 217 190 218 PS_ASSERT_IMAGE_NON_NULL(in, NAN); 191 219 assert (in->type.type == PS_TYPE_F32); 220 192 221 PS_ASSERT_INT_POSITIVE(DX, NAN); 193 222 PS_ASSERT_INT_POSITIVE(DY, NAN); … … 197 226 * Find which binned pixel we're in 198 227 */ 199 const int Xs = (ix + dx)/DX; // index of binned pixel 200 const int Ys = (iy + dy)/DY; 228 229 const int Xs = (ix - dx)/DX; // index of binned pixel 230 const int Ys = (iy - dy)/DY; 201 231 if (Xs < 0 || Xs >= in->numCols || Ys < 0 || Ys >= in->numRows) { 202 232 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Point (%d,%d) lies outside binned image", ix, iy);
Note:
See TracChangeset
for help on using the changeset viewer.
