Changeset 36631 for trunk/psLib/src/imageops/psImageUnbin.c
- Timestamp:
- Apr 2, 2014, 10:08:17 AM (12 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/imageops/psImageUnbin.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/imageops/psImageUnbin.c
r24497 r36631 39 39 int DX = binning->nXbin; 40 40 int DY = binning->nYbin; 41 int dx = binning->nXskip;42 int dy = binning->nYskip;41 // int dx = binning->nXskip; 42 // int dy = binning->nYskip; 43 43 44 44 PS_ASSERT_INT_POSITIVE(DX, NULL); 45 45 PS_ASSERT_INT_POSITIVE(DY, NULL); 46 PS_ASSERT_INT_LESS_THAN_OR_EQUAL(dx, DX, NULL);47 PS_ASSERT_INT_LESS_THAN_OR_EQUAL(dy, DY, NULL);46 // PS_ASSERT_INT_LESS_THAN_OR_EQUAL(dx, DX, NULL); 47 // PS_ASSERT_INT_LESS_THAN_OR_EQUAL(dy, DY, NULL); 48 48 49 49 long nx = in->numCols; … … 57 57 psF32 **vOut = out->data.F32; 58 58 59 int col0 = out->col0; 60 int row0 = out->row0; 61 59 62 // loop over all input pixels excluding the last 60 63 for (int Iy = 0; Iy < ny-1; Iy ++) { … … 70 73 // corresponding to (Ix,Iy), (Ix+1,Iy+1) 71 74 // XXX should this be "+ dx" and + dy? 72 int Xs = PS_MAX (0, PS_MIN (Nx, psImageBinningGetFineX(binning, Ix + 0.5))); 73 int Ys = PS_MAX (0, PS_MIN (Ny, psImageBinningGetFineY(binning, Iy + 0.5))); 75 // Ix,Iy are in input pixels coords; result of GetFine is in the 76 // data space of the output, so we need to subtract col0,row0 to get raw pixels 77 int Xs = PS_MAX (0, PS_MIN (Nx, psImageBinningGetFineX(binning, Ix + 0.5) - col0)); 78 int Ys = PS_MAX (0, PS_MIN (Ny, psImageBinningGetFineY(binning, Iy + 0.5) - row0)); 74 79 int Xe = PS_MAX (0, PS_MIN (Nx, Xs + DX)); 75 80 int Ye = PS_MAX (0, PS_MIN (Ny, Ys + DY)); 81 // fprintf (stderr, "%f, %f, %f, %f : %d, %d : %d - %d, %d - %d\n", V00, V01, V10, V11, Ix, Iy, Xs, Xe, Ys, Ye); 76 82 77 83 for (int iy = Ys; (iy < Ye) && (iy < Ny); iy++) { … … 113 119 114 120 // side pixels 115 int Xs = PS_MAX (0, PS_MIN (Nx, psImageBinningGetFineX(binning, 0 + 0.5) ));116 int Xe = PS_MAX (0, PS_MIN (Nx, psImageBinningGetFineX(binning, nx - 0.5) ));121 int Xs = PS_MAX (0, PS_MIN (Nx, psImageBinningGetFineX(binning, 0 + 0.5) - col0)); 122 int Xe = PS_MAX (0, PS_MIN (Nx, psImageBinningGetFineX(binning, nx - 0.5) - col0)); 117 123 for (int Iy = 0; Iy < ny - 1; Iy++) { 118 124 119 int Ys = PS_MAX (0, PS_MIN (Ny, psImageBinningGetFineY(binning, Iy + 0.5) ));125 int Ys = PS_MAX (0, PS_MIN (Ny, psImageBinningGetFineY(binning, Iy + 0.5) - row0)); 120 126 int Ye = PS_MAX (0, PS_MIN (Ny, Ys + DY)); 121 127 … … 148 154 149 155 // top and bottom pixels 150 int Ys = PS_MAX (0, PS_MIN (Ny, psImageBinningGetFineY(binning, 0 + 0.5) ));151 int Ye = PS_MAX (0, PS_MIN (Ny, psImageBinningGetFineY(binning, ny - 0.5) ));156 int Ys = PS_MAX (0, PS_MIN (Ny, psImageBinningGetFineY(binning, 0 + 0.5) - row0)); 157 int Ye = PS_MAX (0, PS_MIN (Ny, psImageBinningGetFineY(binning, ny - 0.5) - row0)); 152 158 for (int Ix = 0; Ix < nx - 1; Ix++) { 153 159 154 int Xs = PS_MAX (0, PS_MIN (Nx, psImageBinningGetFineX(binning, Ix + 0.5) ));160 int Xs = PS_MAX (0, PS_MIN (Nx, psImageBinningGetFineX(binning, Ix + 0.5) - col0)); 155 161 int Xe = PS_MAX (0, PS_MIN (Nx, Xs + DX)); 156 162 … … 187 193 float V; 188 194 // center of last pixel 189 int Xs = PS_MAX (0, PS_MIN (Nx, psImageBinningGetFineX(binning, 0 + 0.5) ));190 int Xe = PS_MAX (0, PS_MIN (Nx, psImageBinningGetFineX(binning, nx - 0.5) ));191 int Ys = PS_MAX (0, PS_MIN (Ny, psImageBinningGetFineY(binning, 0 + 0.5) ));192 int Ye = PS_MAX (0, PS_MIN (Ny, psImageBinningGetFineY(binning, ny - 0.5) ));195 int Xs = PS_MAX (0, PS_MIN (Nx, psImageBinningGetFineX(binning, 0 + 0.5) - col0)); 196 int Xe = PS_MAX (0, PS_MIN (Nx, psImageBinningGetFineX(binning, nx - 0.5) - col0)); 197 int Ys = PS_MAX (0, PS_MIN (Ny, psImageBinningGetFineY(binning, 0 + 0.5) - row0)); 198 int Ye = PS_MAX (0, PS_MIN (Ny, psImageBinningGetFineY(binning, ny - 0.5) - row0)); 193 199 194 200 // 0,0
Note:
See TracChangeset
for help on using the changeset viewer.
