Changeset 28006 for trunk/pswarp/src/pswarpTransformTile.c
- Timestamp:
- May 18, 2010, 2:34:09 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
pswarp/src/pswarpTransformTile.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/pap (added) merged: 27707-27709,27726-27727,27732-27733,27787,27791-27792,27933,28003-28005 /branches/pap_delete removed
- Property svn:mergeinfo changed
-
trunk/pswarp/src/pswarpTransformTile.c
r27096 r28006 44 44 args->yMax = PS_MIN_S32; 45 45 args->covariance = NULL; 46 args->jacobian = NAN; 46 47 47 48 return args; … … 50 51 bool pswarpTransformTile(pswarpTransformTileArgs *args) 51 52 { 52 psImage *inImage = args->input->image; ///< Input image 53 psImage *outImage = args->output->image; ///< Output image 53 pmReadout *input = args->input; // Input readout 54 psImage *inImage = input->image, *inMask = input->mask; // Input images 55 pmReadout *output = args->output; // Output readout 56 psImage *outImage = output->image, *outVariance = output->variance, *outMask = output->mask; // Outputs 54 57 55 58 int inNumCols = inImage->numCols, inNumRows = inImage->numRows; ///< Size of input image … … 61 64 62 65 // Dereference images for convenience 63 psF32 **outImageData = args->output->image->data.F32;64 psF32 **outVarData = (args->output->variance) ? args->output->variance->data.F32 : NULL;65 psImageMaskType **outMaskData = (args->output->mask) ? args->output->mask->data.PS_TYPE_IMAGE_MASK_DATA : NULL;66 psImageMaskType **inMaskData = (args->input->mask) ? args->input->mask->data.PS_TYPE_IMAGE_MASK_DATA : NULL;66 psF32 **outImageData = outImage->data.F32; 67 psF32 **outVarData = outVariance ? outVariance->data.F32 : NULL; 68 psImageMaskType **outMaskData = outMask ? outMask->data.PS_TYPE_IMAGE_MASK_DATA : NULL; 69 psImageMaskType **inMaskData = inMask ? inMask->data.PS_TYPE_IMAGE_MASK_DATA : NULL; 67 70 68 71 pswarpMap *map = args->grid->maps[args->gridX][args->gridY]; ///< Map for this tile … … 74 77 int yMin = PS_MAX(minPt.y, 0); 75 78 int yMax = PS_MIN(maxPt.y, outNumRows); 79 80 double jacobian = map->Xx * map->Yy - map->Yx * map->Xy; // Jacobian of transformation 81 double jacobian2 = PS_SQR(jacobian); // Square Jacobian 76 82 77 83 // Iterate over the output image pixels (parent frame) … … 87 93 // pswarpMapApply converts the output coordinate (x,y) to the input coordinate. 88 94 // both are in the parent frames of the input and output images. 89 double xInRaw, yInRaw; // Input raw pixel coordinates 90 pswarpMapApply(&xInRaw, &yInRaw, map, x + 0.5, y + 0.5); 91 double xIn = xInRaw - outCol0, yIn = yInRaw - outRow0; // Position on input image 95 double xIn, yIn; // Input pixel coordinates 96 pswarpMapApply(&xIn, &yIn, map, x + 0.5, y + 0.5); 92 97 if (xIn < 0 || xIn >= inNumCols || yIn < 0 || yIn >= inNumRows) { 93 98 continue; … … 105 110 106 111 if (outImageData) { 107 outImageData[yOut][xOut] = imageValue ;112 outImageData[yOut][xOut] = imageValue * jacobian; 108 113 } 109 114 if (outVarData) { 110 outVarData[yOut][xOut] = varValue ;115 outVarData[yOut][xOut] = varValue * jacobian2; 111 116 } 112 117 if (outMaskData) { … … 122 127 double xIn, yIn; // Position of interest on input 123 128 pswarpMapApply(&xIn, &yIn, map, xOut + 0.5, yOut + 0.5); 124 // XXX Why are we subtracting the *output* col0,row0 from the *input* coordinates?125 // I expect these are zero, so that it makes no difference, but it's distracting.126 xIn -= outCol0;127 yIn -= outRow0;128 129 psKernel *kernel = psImageInterpolationKernel(xIn, yIn, args->interp->mode); // Interpolation kernel 129 130 args->covariance = psImageCovarianceCalculate(kernel, args->input->covariance); 131 args->jacobian = sqrt(jacobian); 130 132 psFree(kernel); 131 133 }
Note:
See TracChangeset
for help on using the changeset viewer.
