Changeset 7634
- Timestamp:
- Jun 22, 2006, 10:08:04 AM (20 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/camera/pmFPAMosaic.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPAMosaic.c
r7628 r7634 466 466 continue; 467 467 } 468 int xParity = xFlip->data.U8[i] ? -1 : 1; // Parity difference, in x 469 int yParity = yFlip->data.U8[i] ? -1 : 1; // Parity difference, in y 468 470 if (xBinSource->data.S32[i] == xBinTarget && yBinSource->data.S32[i] == yBinTarget && 469 471 xFlip->data.U8[i] == 0 && yFlip->data.U8[i] == 0) { 470 472 // Let someone else do the hard work; useful to test psImageOverlaySection if no other reason 471 473 psImageOverlaySection(mosaic, image, x0->data.S32[i] - xMin, y0->data.S32[i] - yMin, "+"); 474 } else if (xBinSource->data.S32[i] == xBinTarget && yBinSource->data.S32[i] == yBinTarget) { 475 // There's a difference with the parities, but we don't have to worry about binning 476 477 #define COPY_WITH_PARITY_DIFFERENCE(TYPE) \ 478 case PS_TYPE_##TYPE: { \ 479 int yTargetBase = (y0->data.S32[i] - yMin) / yBinTarget; \ 480 int xTargetBase = (x0->data.S32[i] - xMin) / xBinTarget; \ 481 for (int y = 0; y < image->numRows; y++) { \ 482 int yTarget = yTargetBase + yParity * y; \ 483 for (int x = 0; x < image->numCols; x++) { \ 484 int xTarget = xTargetBase + xParity * x; \ 485 mosaic->data.TYPE[yTarget][xTarget] += image->data.TYPE[y][x]; \ 486 } \ 487 } \ 488 } \ 489 break; 490 491 switch (type) { 492 COPY_WITH_PARITY_DIFFERENCE(F32); 493 COPY_WITH_PARITY_DIFFERENCE(U8); 494 default: 495 psAbort(__func__, "Should never get here.\n"); 496 } 497 472 498 } else { 473 // We have to do the hard work ourself 474 for (int y = 0; y < image->numRows; y++) { 475 int yParity = yFlip->data.U8[i] ? -1 : 1; 476 float yTargetBase = (y0->data.S32[i] + yParity * yBinSource->data.S32[i] * y - yMin) / 477 yBinTarget; 478 for (int x = 0; x < image->numCols; x++) { 479 int xParity = xFlip->data.U8[i] ? -1 : 1; 480 float xTargetBase = (x0->data.S32[i] + xParity * xBinSource->data.S32[i] * x - xMin) / 481 xBinTarget; 482 483 // In case the original image is binned but the mosaic is not, we need to fill in the 484 // values in the mosaic. 485 #define FILL_IN(TYPE) \ 486 for (int j = 0; j < yBinSource->data.S32[i]; j++) { \ 487 int yTarget = (int)(yTargetBase + yParity * (float)j / (float)yBinTarget); \ 488 for (int k = 0; k < xBinSource->data.S32[i]; k++) { \ 489 int xTarget = (int)(xTargetBase + xParity * (float)k / (float)xBinTarget); \ 490 mosaic->data.TYPE[yTarget][xTarget] += image->data.TYPE[y][x]; \ 491 } \ 492 } 493 494 switch (type) { 495 case PS_TYPE_F32: 496 FILL_IN(F32); 497 break; 498 case PS_TYPE_U8: 499 FILL_IN(U8); 500 break; 501 default: 502 psAbort(__func__, "Should never get here.\n"); 503 } 504 505 } 506 } // Iterating over input image 507 } 508 } 499 // We have to do all of the hard work ourself 500 501 // In case the original image is binned but the mosaic is not, we need to fill in the 502 // values in the mosaic. 503 504 505 #define FILL_IN(TYPE) \ 506 case PS_TYPE_##TYPE: \ 507 for (int y = 0; y < image->numRows; y++) { \ 508 float yTargetBase = (y0->data.S32[i] + yParity * yBinSource->data.S32[i] * y - yMin) / \ 509 yBinTarget; \ 510 for (int x = 0; x < image->numCols; x++) { \ 511 float xTargetBase = (x0->data.S32[i] + xParity * xBinSource->data.S32[i] * x - xMin) / \ 512 xBinTarget; \ 513 for (int j = 0; j < yBinSource->data.S32[i]; j++) { \ 514 int yTarget = (int)(yTargetBase + yParity * (float)j / (float)yBinTarget); \ 515 for (int k = 0; k < xBinSource->data.S32[i]; k++) { \ 516 int xTarget = (int)(xTargetBase + xParity * (float)k / (float)xBinTarget); \ 517 mosaic->data.TYPE[yTarget][xTarget] += image->data.TYPE[y][x]; \ 518 } \ 519 } \ 520 } \ 521 } \ 522 break; 523 524 switch (type) { 525 FILL_IN(F32); 526 FILL_IN(U8); 527 default: 528 psAbort(__func__, "Should never get here.\n"); 529 } 530 531 } // Various difficulty levels 532 } // Iterating over images 509 533 510 534 return mosaic; … … 976 1000 // Check to see if the target has a smaller binning in mind 977 1001 int xBinTarget = psMetadataLookupS32(&mdok, targetCell->concepts, "CELL.XBIN"); 978 if (!mdok || xBinTarget == 0) { 979 psLogMsg(__func__, PS_LOG_WARN, "CELL.XBIN is not set for the target cell; assuming %d.\n", *xBinFPA); 980 } else { 1002 if (mdok && xBinTarget != 0) { 981 1003 *xBinFPA = xBinTarget; 982 1004 } 983 1005 int yBinTarget = psMetadataLookupS32(&mdok, targetCell->concepts, "CELL.YBIN"); 984 if (!mdok || yBinTarget == 0) { 985 psLogMsg(__func__, PS_LOG_WARN, "CELL.YBIN is not set for the target cell; assuming %d.\n", *yBinFPA); 986 } else { 1006 if (mdok && yBinTarget != 0) { 987 1007 *yBinFPA = yBinTarget; 988 1008 }
Note:
See TracChangeset
for help on using the changeset viewer.
