IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 14, 2005, 2:12:09 PM (21 years ago)
Author:
desonia
Message:

fixed image FFT and image convolution. The FFTW call had the wrong order
of dimensions, and the scaling was incorrect.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/imageops/psImageConvolve.c

    r3682 r3702  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2005-04-07 20:27:41 $
     7 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2005-04-15 00:12:08 $
    99 *
    1010 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    398398        }
    399399
    400         psImageWriteSection(paddedImage,0,0,0,NULL,0,"paddedImage.fits");
    401 
    402400        // pad the kernel to the same size of paddedImage
    403401        psImage* paddedKernel = psImageAlloc(paddedCols,paddedRows,PS_TYPE_KERNEL);
     
    421419        }
    422420
    423         psImageWriteSection(paddedKernel,0,0,0,NULL,0,"paddedKernel.fits");
    424 
    425421        psImage* kernelFourier = psImageFFT(NULL, paddedKernel, PS_FFT_FORWARD);
    426422        if (kernelFourier == NULL) {
     
    440436
    441437        // convolution in fourier domain is just a pixel-wise multiplication
    442         psBinaryOp(inFourier,inFourier,"*",kernelFourier);
     438        for (int row = 0; row < paddedRows; row++) {
     439            psC32* inRow = inFourier->data.C32[row];
     440            psC32* kRow = kernelFourier->data.C32[row];
     441            for (int col = 0; col < paddedCols; col++) {
     442                inRow[col] *= kRow[col];
     443            }
     444        }
    443445
    444446        psImage* complexOut = psImageFFT(NULL, inFourier,
     
    451453        }
    452454
    453         {
    454             psImage* tmp = psImageReal(NULL,complexOut);
    455             psImageWriteSection(tmp,0,0,0,NULL,0,"complexOut.fits");
    456             psFree(tmp);
    457         }
    458 
    459455        // subset out the padded area now.
    460456        psImage* complexOutSansPad = psImageSubset(complexOut,
     
    463459
    464460        out = psImageRecycle(out,numCols,numRows,PS_TYPE_F32);
    465         float factor = 1.0f/numCols/numRows;
     461        float factor = 1.0f/(float)paddedCols/(float)paddedRows;
    466462        for (psS32 row = 0; row < numRows; row++) {
    467463            psF32* outRow = out->data.F32[row];
Note: See TracChangeset for help on using the changeset viewer.