Changeset 11795
- Timestamp:
- Feb 14, 2007, 2:38:51 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
r11299 r11795 11 11 12 12 // interpolate from model to background (~bresenham linear interpolation) 13 // XXX this code skips the initial pixels? 14 // XXX this code may be off by 0.5,0.5 pixels 13 // DX, DY are the binning factor 14 // dx, dy is the distance is high-res pixels to the 0,0 corner of the first 15 // binned pixel. 16 // XXX check that this is still consistent with psphotImageMedian... 15 17 psImage *psImageUnbin(psImage *out, const psImage *in, int DX, int DY, int dx, int dy) 16 18 { … … 30 32 psF32 **vOut = out->data.F32; 31 33 32 // loop over all pixels with34 // loop over all input pixels excluding the last 33 35 for (int Iy = 0; Iy < ny-1; Iy ++) { 34 36 for (int Ix = 0; Ix < nx-1; Ix ++) { … … 126 128 } 127 129 } 130 // return out; 128 131 129 132 // the four corners 130 133 { 131 134 float V; 135 // center of last pixel 136 int Xs = PS_MAX (0, PS_MIN (Nx, ( 0 + 0.5)*DX - dx)); 137 int Xe = PS_MAX (0, PS_MIN (Nx, (nx - 0.5)*DX - dx)); 138 int Ys = PS_MAX (0, PS_MIN (Ny, ( 0 + 0.5)*DY - dy)); 139 int Ye = PS_MAX (0, PS_MIN (Ny, (ny - 0.5)*DY - dy)); 140 132 141 // 0,0 133 142 V = vIn[0][0]; 134 for (int iy = 0; iy < DY - dy; iy++)135 { 136 for (int ix = 0; ix < DX - dx; ix++) {143 for (int iy = 0; iy < Ys; iy++) 144 { 145 for (int ix = 0; ix < Xs; ix++) { 137 146 vOut[iy][ix] = V; 138 147 } … … 140 149 // Nx,0 141 150 V = vIn[0][nx-1]; 142 for (int iy = 0; iy < DY - dy; iy++)143 { 144 for (int ix = nx*DX - dx; ix < Nx; ix++) {151 for (int iy = 0; iy < Ys; iy++) 152 { 153 for (int ix = Xe; ix < Nx; ix++) { 145 154 vOut[iy][ix] = V; 146 155 } … … 148 157 // 0,Ny 149 158 V = vIn[ny-1][0]; 150 for (int iy = ny*DY - dy; iy < Ny; iy++)151 { 152 for (int ix = 0; ix < DX - dx; ix++) {159 for (int iy = Ye; iy < Ny; iy++) 160 { 161 for (int ix = 0; ix < Xs; ix++) { 153 162 vOut[iy][ix] = V; 154 163 } … … 156 165 // Nx,Ny 157 166 V = vIn[ny-1][nx-1]; 158 for (int iy = ny*DY - dy; iy < Ny; iy++)159 { 160 for (int ix = nx*DX - dx; ix < Nx; ix++) {167 for (int iy = Ye; iy < Ny; iy++) 168 { 169 for (int ix = Xe; ix < Nx; ix++) { 161 170 vOut[iy][ix] = V; 162 171 }
Note:
See TracChangeset
for help on using the changeset viewer.
