Changeset 6887 for trunk/stac/src/stacErrorImages.c
- Timestamp:
- Apr 18, 2006, 12:20:45 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/stac/src/stacErrorImages.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/stac/src/stacErrorImages.c
r3666 r6887 4 4 5 5 psArray *stacErrorImages(psArray *inputs, // Array of input images 6 float gain,// Gain, in e/ADU7 float rn// Read noise, in e6 float gain, // Gain, in e/ADU 7 float rn // Read noise, in e 8 8 ) 9 9 { 10 float invGain = 1.0/gain; // Inverse square root of gain11 rn /= gain; // Read noise in ADU10 float invGain = 1.0/gain; // Inverse square root of gain 11 rn /= gain; // Read noise in ADU 12 12 psArray *errors = psArrayAlloc(inputs->n); 13 errors->n = inputs->n; 13 14 14 15 psTrace("stac.errors", 1, "Calculating error images....\n"); … … 16 17 // Iterate over the input images 17 18 for (int i = 0; i < inputs->n; i++) { 18 psTrace("stac.errors",5,"Working on image #%d\n",i);19 psTrace("stac.errors",5,"Working on image #%d\n",i); 19 20 20 psImage *image = inputs->data[i]; // Pull out the image of interest21 int numRows = image->numRows;// Number of rows22 int numCols = image->numCols; // Number of columns 23 psImage *error = psImageAlloc(numCols, numRows, PS_TYPE_F32); // The error image21 psImage *image = inputs->data[i]; // Pull out the image of interest 22 int numRows = image->numRows; // Number of rows 23 int numCols = image->numCols; // Number of columns 24 psImage *error = psImageAlloc(numCols, numRows, PS_TYPE_F32); // The error image 24 25 25 // Iterate over the pixels26 for (int r = 0; r < numRows; r++) {27 for (int c = 0; c < numCols; c++) {28 // We actually calculate the variance29 error->data.F32[r][c] = image->data.F32[r][c]*invGain + rn*rn;30 }31 }26 // Iterate over the pixels 27 for (int r = 0; r < numRows; r++) { 28 for (int c = 0; c < numCols; c++) { 29 // We actually calculate the variance 30 error->data.F32[r][c] = image->data.F32[r][c]*invGain + rn*rn; 31 } 32 } 32 33 33 // Put image onto the array34 errors->data[i] = error;34 // Put image onto the array 35 errors->data[i] = error; 35 36 } 36 37
Note:
See TracChangeset
for help on using the changeset viewer.
