Changeset 33700
- Timestamp:
- Apr 4, 2012, 10:35:28 AM (14 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/cmd.astro/fiximage.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/cmd.astro/fiximage.c
r33662 r33700 34 34 // 4 -- repair y only 35 35 // 6 -- repair x & y only 36 36 37 37 float *inB = (float *) in[0].matrix.buffer; 38 38 float *ctB = (float *) ct[0].matrix.buffer; 39 39 float *mkB = (float *) mask[0].matrix.buffer; 40 40 41 // loop over input ct and find pixels that can be repaired. 41 // loop over input ct and find pixels that can be repaired. 42 42 for (iy = 1; iy < Ny - 1; iy++) { 43 43 for (ix = 1; ix < Nx - 1; ix++) { 44 44 45 45 int Npix = ix + Nx*iy; 46 46 47 47 // does not need to be repaired 48 48 if (ctB[Npix]) { mkB[Npix] = 1.0; continue; } 49 49 50 50 // if we have all 4 valid neighbors, we can fix 51 51 if (ctB[Npix - 1 ] && ctB[Npix + 1 ]) mkB[Npix] += 2.0; … … 53 53 } 54 54 } 55 55 56 56 // loop over input ct and repair the reparable pixels 57 57 for (iy = 1; iy < Ny - 1; iy++) { 58 58 for (ix = 1; ix < Nx - 1; ix++) { 59 59 60 60 int Npix = ix + Nx*iy; 61 61 … … 63 63 if (mkB[Npix] == 1.0) continue; // does not need to be repaired 64 64 65 float Vxm, Vxp, Vym, Vyp, Value; 65 float Vxm = 0.0; 66 float Vxp = 0.0; 67 float Vym = 0.0; 68 float Vyp = 0.0; 69 float Value = 0.0; 66 70 if ((mkB[Npix] == 2) || (mkB[Npix] == 6)) { 67 Vxm = inB[Npix - 1 ] / ctB[Npix - 1 ];68 Vxp = inB[Npix + 1 ] / ctB[Npix + 1 ];71 Vxm = inB[Npix - 1 ] / ctB[Npix - 1 ]; 72 Vxp = inB[Npix + 1 ] / ctB[Npix + 1 ]; 69 73 } 70 74 if ((mkB[Npix] == 4) || (mkB[Npix] == 6)) { 71 Vym = inB[Npix - Nx] / ctB[Npix - Nx];72 Vyp = inB[Npix + Nx] / ctB[Npix + Nx];75 Vym = inB[Npix - Nx] / ctB[Npix - Nx]; 76 Vyp = inB[Npix + Nx] / ctB[Npix + Nx]; 73 77 } 74 78 75 79 if (mkB[Npix] == 2) { 76 Value = 0.5*(Vxm + Vxp);80 Value = 0.5*(Vxm + Vxp); 77 81 } 78 82 if (mkB[Npix] == 4) { 79 Value = 0.5*(Vym + Vyp);83 Value = 0.5*(Vym + Vyp); 80 84 } 81 85 if (mkB[Npix] == 6) { 82 Value = 0.25*(Vxm + Vxp + Vym + Vyp);86 Value = 0.25*(Vxm + Vxp + Vym + Vyp); 83 87 } 84 88
Note:
See TracChangeset
for help on using the changeset viewer.
