- Timestamp:
- Dec 8, 2009, 7:11:00 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20091201/psModules/src/imcombine/pmSubtractionVisual.c
r26341 r26373 308 308 // if (!pmVisualIsVisual()) return true; 309 309 310 double sum; 311 310 312 int NXoff = index % NX; 311 313 int NYoff = index / NX; … … 315 317 316 318 // insert the (target) kernel into the (target) image: 319 sum = 0.0; 317 320 for (int y = -footprint; y <= footprint; y++) { 318 321 for (int x = -footprint; x <= footprint; x++) { 319 322 targetImage->data.F32[y + NYpix][x + NXpix] = target->kernel[y][x]; 320 } 321 } 323 sum += targetImage->data.F32[y + NYpix][x + NXpix]; 324 } 325 } 326 targetImage->data.F32[footprint + 1 + NYpix][NXpix] = sum; 322 327 323 328 // insert the (source) kernel into the (source) image: 329 sum = 0.0; 324 330 for (int y = -footprint; y <= footprint; y++) { 325 331 for (int x = -footprint; x <= footprint; x++) { 326 332 sourceImage->data.F32[y + NYpix][x + NXpix] = source->kernel[y][x]; 327 } 328 } 329 333 sum += sourceImage->data.F32[y + NYpix][x + NXpix]; 334 } 335 } 336 sourceImage->data.F32[footprint + 1 + NYpix][NXpix] = sum; 337 330 338 // insert the (convolution) kernel into the (convolution) image: 339 sum = 0.0; 331 340 for (int y = -footprint; y <= footprint; y++) { 332 341 for (int x = -footprint; x <= footprint; x++) { 333 342 convolutionImage->data.F32[y + NYpix][x + NXpix] = -convolution->kernel[y][x]; 334 } 335 } 343 sum += convolutionImage->data.F32[y + NYpix][x + NXpix]; 344 } 345 } 346 convolutionImage->data.F32[footprint + 1 + NYpix][NXpix] = sum; 336 347 337 348 // insert the (difference) kernel into the (difference) image: 349 sum = 0.0; 338 350 for (int y = -footprint; y <= footprint; y++) { 339 351 for (int x = -footprint; x <= footprint; x++) { 340 352 differenceImage->data.F32[y + NYpix][x + NXpix] = target->kernel[y][x] - background - source->kernel[y][x] * norm; 341 } 342 } 353 sum += differenceImage->data.F32[y + NYpix][x + NXpix]; 354 } 355 } 356 differenceImage->data.F32[footprint + 1 + NYpix][NXpix] = sum; 343 357 344 358 // insert the (residual) kernel into the (residual) image: 359 sum = 0.0; 345 360 for (int y = -footprint; y <= footprint; y++) { 346 361 for (int x = -footprint; x <= footprint; x++) { 347 362 residualImage->data.F32[y + NYpix][x + NXpix] = target->kernel[y][x] - background - source->kernel[y][x] * norm + convolution->kernel[y][x]; 348 } 349 } 363 sum += residualImage->data.F32[y + NYpix][x + NXpix]; 364 } 365 } 366 residualImage->data.F32[footprint + 1 + NYpix][NXpix] = sum; 350 367 351 368 // insert the (fresidual) kernel into the (fresidual) image: 352 369 for (int y = -footprint; y <= footprint; y++) { 353 370 for (int x = -footprint; x <= footprint; x++) { 354 fresidualImage->data.F32[y + NYpix][x + NXpix] = PS_SQR(residualImage->data.F32[y + NYpix][x + NXpix]) / (target->kernel[y][x] + 25.0);371 fresidualImage->data.F32[y + NYpix][x + NXpix] = residualImage->data.F32[y + NYpix][x + NXpix] / sqrt(PS_MAX(target->kernel[y][x], 100.0)); 355 372 } 356 373 }
Note:
See TracChangeset
for help on using the changeset viewer.
