Changeset 2765
- Timestamp:
- Dec 20, 2004, 6:25:31 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/stac/src/stacRejection.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/stac/src/stacRejection.c
r2764 r2765 136 136 #ifdef TESTING 137 137 rejmap->data.F32[y][x] = maskVal; 138 139 // Calculate gradient 140 float meanGrads = 0.0; 141 int numGrads = 0; 142 for (int j = 0; j < nImages; j++) { 143 if (i != j) { 144 // Get coordinates for that image 145 (void)psPlaneTransformApply(inCoords, inverseMaps->data[j], outCoords); 146 int xPix = (int)(inCoords->x + 0.5); 147 int yPix = (int)(inCoords->y + 0.5); 148 if ((xPix >= 0) && (xPix <= ((psImage*)(inputs->data[j]))->numCols - 1) && 149 (yPix >= 0) && (yPix <= ((psImage*)(inputs->data[j]))->numRows - 1)) { 150 // Calculate the gradient 151 meanGrads += stacGradient(inputs->data[j], xPix, yPix); 152 numGrads++; 138 #endif 139 140 if (maskVal > config->frac) { 141 // Calculate mean gradient on other images 142 float meanGrads = 0.0; 143 int numGrads = 0; 144 for (int j = 0; j < nImages; j++) { 145 if (i != j) { 146 // Get coordinates for that image 147 (void)psPlaneTransformApply(inCoords, inverseMaps->data[j], outCoords); 148 int xPix = (int)(inCoords->x + 0.5); 149 int yPix = (int)(inCoords->y + 0.5); 150 if ((xPix >= 0) && (xPix <= ((psImage*)(inputs->data[j]))->numCols - 1) && 151 (yPix >= 0) && (yPix <= ((psImage*)(inputs->data[j]))->numRows - 1)) { 152 // Calculate the gradient 153 meanGrads += stacGradient(inputs->data[j], xPix, yPix); 154 numGrads++; 155 } 153 156 } 154 157 } 155 }156 if (numGrads > 0) {157 meanGrads /= (float)numGrads;158 } else {159 meanGrads = 0;160 } 161 grad->data.F32[y][x] = stacGradient(inputs->data[i], x, y) / meanGrads; 162 #endif 163 164 if ((maskVal > config->frac) && 165 (stacGradient(inputs->data[i], x, y)) < config->grad * meanGrads) {166 mask->data.U8[y][x] = 1;167 nBad++;158 if (numGrads > 0) { 159 meanGrads /= (float)numGrads; 160 } else { 161 meanGrads = 0; 162 } 163 164 #ifdef TESTING 165 grad->data.F32[y][x] = stacGradient(inputs->data[i], x, y) / meanGrads; 166 #endif 167 168 if (stacGradient(inputs->data[i], x, y) < config->grad * meanGrads) { 169 mask->data.U8[y][x] = 1; 170 nBad++; 168 171 #ifdef CRFLUX 169 fprintf(crs, "%d %d --> %f %f %f\n", x, y, 170 ((psImage*)(inputs->data[i]))->data.F32[y][x], maskVal, 171 stacGradient(inputs->data[i], x, y)); 172 #endif 172 fprintf(crs, "%d %d --> %f %f %f\n", x, y, 173 ((psImage*)(inputs->data[i]))->data.F32[y][x], maskVal, 174 stacGradient(inputs->data[i], x, y)); 175 #endif 176 } else { 177 mask->data.U8[y][x] = 0; 178 } // Gradient threshold 173 179 } else { 174 180 mask->data.U8[y][x] = 0; 175 } 176 181 } // Rejection threshold 182 183 } else { 184 mask->data.U8[y][x] = 0; 177 185 } // Only touching pixels of interest 178 186
Note:
See TracChangeset
for help on using the changeset viewer.
