IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4037


Ignore:
Timestamp:
May 25, 2005, 2:13:48 PM (21 years ago)
Author:
gusciora
Message:

Resolved a few more (x, y) issues.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/pmImageSubtract.c

    r4036 r4037  
    55 *  @author GLG, MHPCC
    66 *
    7  *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2005-05-25 23:59:08 $
     7 *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2005-05-26 00:13:48 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7575    // for convenience.
    7676    //
    77     // XXX: replace (i, j) with (xOrder, yOrder) for clarity.
    78     //
    7977    psS32 ptr = 0;
    8078    for (psS32 order = 0; order <= spatialOrder; order++) {
    81         for (psS32 i = 0; i <= order; i++) {
    82             psS32 j = order - i;
     79        for (psS32 xOrder = 0; xOrder <= order; xOrder++) {
     80            psS32 yOrder = order - xOrder;
    8381            tmp->u->data.F32[ptr] = 0;
    8482            tmp->v->data.F32[ptr] = 0;
    85             tmp->xOrder->data.F32[ptr] = i;
    86             tmp->yOrder->data.F32[ptr] = j;
     83            tmp->xOrder->data.F32[ptr] = xOrder;
     84            tmp->yOrder->data.F32[ptr] = yOrder;
    8785            ptr++;
    8886        }
     
    10098                // x^i * y^j  such that (i+j) <= spatialOrder.
    10199                //
    102                 // XXX: replace (i, j) with (xOrder, yOrder) for clarity.
    103                 //
    104100                for (psS32 order = 0; order <= spatialOrder; order++) {
    105                     for (psS32 i = 0; i <= order; i++) {
    106                         psS32 j = order - i;
     101                    for (psS32 xOrder = 0; xOrder <= order; xOrder++) {
     102                        psS32 yOrder = order - xOrder;
    107103                        tmp->u->data.F32[ptr] = 0;
    108104                        tmp->v->data.F32[ptr] = 0;
    109                         tmp->xOrder->data.F32[ptr] = i;
    110                         tmp->yOrder->data.F32[ptr] = j;
     105                        tmp->xOrder->data.F32[ptr] = xOrder;
     106                        tmp->yOrder->data.F32[ptr] = yOrder;
    111107                        ptr++;
    112108                    }
     
    177173    // This loop creates
    178174    //
    179     // XXX: Put the v loop before the u loop.
    180     // XXX: Put the orderYTerm loop before the orderXTerm loop.
    181175    // XXX: must loop on the sigmas.
    182176    //
     
    191185            psImage *currKernel = (psImage *) psImageAlloc(1 + (2 * size), 1 + (2 * size), PS_TYPE_F32);
    192186
    193             for (psS32 u = -xKernelHalfSize; u <= xKernelHalfSize; u++) {
    194                 for (psS32 v = -yKernelHalfSize; v <= yKernelHalfSize; v++) {
     187            for (psS32 v = -yKernelHalfSize; v <= yKernelHalfSize; v++) {
     188                for (psS32 u = -xKernelHalfSize; u <= xKernelHalfSize; u++) {
    195189                    // Scale the (u,v) coordinates in kernel space to [-1.0:1.0].
    196190                    psF32 uScaled = ((psF32) (u - xKernelHalfSize)) / ((psF32) (1 + (2 * xKernelHalfSize)));
     
    199193                    psF32 exponent = (PS_SQR(uScaled) * PS_SQR(vScaled)) /
    200194                                     (2.0 * PS_SQR(sigmas->data.F32[sigPtr]));
    201                     currKernel->data.F32[u+xKernelHalfSize][v+yKernelHalfSize] =
     195                    currKernel->data.F32[v+yKernelHalfSize][u+xKernelHalfSize] =
    202196                        exp(exponent) * pow(uScaled, orderXTerm) + pow(vScaled, orderYTerm);
    203197                }
     
    209203    //
    210204    // sigPtr loops through each sigma value in the *sigmas argument.
    211     // XXX: Put the v loop before the u loop.
    212     // XXX: Put the orderYTerm loop before the orderXTerm loop.
    213205    //
    214206    psS32 ptr = 0;
     
    250242                        psImage *currKernel = (psImage *) tmp->preCalc->data[ptr];
    251243
    252                         for (psS32 u = -xKernelHalfSize; u <= xKernelHalfSize; u++) {
    253                             for (psS32 v = -yKernelHalfSize; v <= yKernelHalfSize; v++) {
     244                        for (psS32 v = -yKernelHalfSize; v <= yKernelHalfSize; v++) {
     245                            for (psS32 u = -xKernelHalfSize; u <= xKernelHalfSize; u++) {
    254246                                // Scale the (u,v) coordinates in kernel space to [-1.0:1.0].
    255247                                psF32 uScaled = ((psF32) (u - xKernelHalfSize)) / ((psF32) (1 + (2 * xKernelHalfSize)));
     
    259251                                psF32 exponent = (PS_SQR(uScaled) * PS_SQR(vScaled)) /
    260252                                                 (2.0 * PS_SQR(sigmas->data.F32[sigPtr]));
    261                                 currKernel->data.F32[u+xKernelHalfSize][v+yKernelHalfSize] =
     253                                currKernel->data.F32[v+yKernelHalfSize][u+xKernelHalfSize] =
    262254                                    exp(exponent) * pow(uScaled, orderXTerm) + pow(vScaled, orderYTerm);
    263255                            }
     
    274266}
    275267
    276 // XXX: These should maybe be public, maybe private global, or private local.
    277268void p_pmStampFree(pmStamp *stamp)
    278269{
     
    282273}
    283274
    284 // XXX: These should maybe be public, maybe private global, or private local.
    285275pmStamp *p_pmStampAlloc(pmStampStatus status)
    286276{
     
    328318    if (stamps != NULL) {
    329319        PS_ASSERT_INT_EQUAL(stamps->n, (xNum * yNum), NULL);
    330         // XXX: Ensure that a pmStamp struct exists at each psArray location.
     320        //
     321        // Ensure that a pmStamp struct exists at each psArray location.
     322        //
    331323        for (psS32 s = 0 ; s < (xNum * yNum) ; s++) {
    332324            if (NULL == stamps->data[s]) {
     
    367359                // border of pixels from the image edge.
    368360                //
    369                 // XXX: verify this (numX, numY), then get rid of it.
     361                // XXX: verify (numX, numY), then get rid of it.
    370362                //
    371363                psS32 numX = xNum;
     
    435427
    436428
    437 
    438429/*******************************************************************************
    439  
    440430XXX: How is the spatial order factor calculated?  Is it simply a x^iy^j power
    441 eavaluated at the (x, y) center for the stamp?  Why bother with the 2-D
    442 polynomial in evaluating it?  Finally, why is it scaled to the half-size of
    443 the reference image?
     431evaluated at the (x, y) center for the stamp?  Why bother with the 2-D
     432polynomial in evaluating it?
    444433 ******************************************************************************/
    445434bool pmSubtractionCalculateEquation(psArray *stamps,          ///< The stamps for which to calculate the equation,
     
    515504            // Iterate over all pixels surrounding this stamp.
    516505            //
    517             // XXX: I modified the y,x loop order, and an [x][y] reference (1.0/reference->data.F32[y][x]).
    518             //      Verify it.
    519             //
    520506            for (psS32 y = stamp->y - footprint; y < stamp->y + footprint; y++) {
    521507                for (psS32 x = stamp->x - footprint; x < stamp->x + footprint; x++) {
     
    547533                                conv1 -= reference->data.F32[y][x];
    548534                            }
    549 
    550535
    551536                            //
     
    710695It returns the value of the convolved pixel.
    711696 
    712 XXX: Parameter checks?
    713  
    714697XXX: Static structure for polyValues?
    715698 ******************************************************************************/
     
    772755the set of kernel basis functions and their appropriate weights in solution.
    773756It returns the value of the convolved pixel.
    774  
    775 XXX: Parameter checks?
    776757 
    777758XXX: Static structure for polyValues?
     
    830811ConvolveImage(input, mask, badStampMaskVal, solution, kernels): convolves an
    831812arbitrary image with either an ISIS or POIS set of kernel basis functions.
    832  
    833 XXX: Function decomposition: create a function which convolves a single
    834 function with a set of POIS kernel basis functions.  Create another for ISIS
    835 kernel basis functions.  Then rewrite this.
    836813 ******************************************************************************/
    837814psImage *ConvolveImage(const psImage *input,
     
    989966    }
    990967
    991 
    992 
    993968    psFree(stats);
    994969    psFree(subStamp);
     
    996971    return deviations;
    997972}
    998 
    999 
    1000 
    1001973
    1002974/*******************************************************************************
     
    10811053
    10821054/*******************************************************************************
    1083 XXX: There are definite (x, y) (row, col) problems here.
    10841055 ******************************************************************************/
    10851056psImage *pmSubtractionKernelImage(psImage *out,
     
    10941065    PS_ASSERT_FLOAT_WITHIN_RANGE(x, -1.0, 1.0, NULL);
    10951066    PS_ASSERT_FLOAT_WITHIN_RANGE(y, -1.0, 1.0, NULL);
    1096     // XXX: Assert that all vectors and arrays in kernels are of the same length.
     1067    PS_ASSERT_VECTORS_SIZE_EQUAL(kernels->u, kernels->v, NULL);
     1068    PS_ASSERT_VECTORS_SIZE_EQUAL(kernels->u, kernels->xOrder, NULL);
     1069    PS_ASSERT_VECTORS_SIZE_EQUAL(kernels->u, kernels->yOrder, NULL);
     1070    PS_ASSERT_VECTORS_SIZE_EQUAL(kernels->u, kernels->preCalc, NULL);
     1071    PS_ASSERT_INT_EQUAL(1+kernels->u->n, solution->n, NULL);
     1072
    10971073    psS32 nBF = kernels->u->n;
    10981074    psS32 spatialOrder = kernels->p_spatialOrder;
Note: See TracChangeset for help on using the changeset viewer.