IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 1415


Ignore:
Timestamp:
Aug 6, 2004, 6:11:59 PM (22 years ago)
Author:
Paul Price
Message:

Added convolution stuff from the modules (phase 2) SDRS.
Still need to add the chebysheves, splines, imageTrim.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/pslib/psLibSDRS.tex

    r1400 r1415  
    1 %%% $Id: psLibSDRS.tex,v 1.62 2004-08-06 19:06:36 eugene Exp $
     1%%% $Id: psLibSDRS.tex,v 1.63 2004-08-07 04:11:59 price Exp $
    22\documentclass[panstarrs,spec]{panstarrs}
    33
     
    323201 & 2004 May 19 & Extensive modifications, see appendix \\ \hline
    333302 & 2004 Jun 22 & Incorporation of Bugzilla PRs (up to 69) \\ \hline
     3403 & 2004 Aug 06 & Adding convolution, splines, chebyshevs \\
     35   &             & (modified polynomials), ImageTrim for Phase 2 \\ \hline
    3436\RevisionsEnd
    3537
     
    18851887\subsection{Analytical functions}
    18861888
    1887 \subsubsection{General Polynomials}
     1889\subsubsection{Polynomials}
    18881890
    18891891PSLib provides APIs to represent and interact with polynomials in up
     
    26302632psImage *psImagePowerSpectrum(psImage *out, const psImage *in);
    26312633\end{verbatim}
     2634
     2635%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     2636
     2637\subsubsection{Convolution}
     2638
     2639Convolution will be an essential operation for the IPP.  For example,
     2640if images on the sky are obtained in Orthogonal Transfer (OT) mode,
     2641then the calibration frames used to correct them must be convolved by
     2642a kernel derived from the list of OT shifts made during the exposure.
     2643Also, convolution is also required for object detection and
     2644PSF-matching.
     2645
     2646\subsubsubsection{Kernel definition}
     2647
     2648In order to perform a convolution, we need to define the convolution
     2649kernel.  We need a more general object than a \code{psImage} so that
     2650we can incorporate the offset from the $(0,0)$ pixel to the $(0,0)$
     2651value of the kernel.  It might be convenient to allow both positive
     2652and negative indices to convey the positive and negative shifts.  One
     2653might consider setting the \code{x0} and \code{y0} members of a
     2654\code{psImage} to the appropriate offsets, but this is not the purpose
     2655of these members, and doing so may affect the behavior of other
     2656\code{psImage} operations.  We define a \code{psKernel}:
     2657
     2658\begin{verbatim}
     2659/** A convolution kernel */
     2660typedef struct {
     2661    psImage *data;                      ///< Kernel data, in the form of an image
     2662    int xMin, yMin;                     ///< Most negative indices
     2663    int xMax, yMax;                     ///< Most positive indices
     2664    float **kernelRows;                 ///< Pointer to the rows of the kernel data
     2665    float **kernel;                     ///< Pointer to  in the kernel data
     2666} psKernel;
     2667\end{verbatim}
     2668
     2669The kernel data is carried primarily by the \code{data} member which
     2670is a normal \code{psImage}.  In order to allow negative indices, we
     2671add two additional members.  \code{kernelRows} is an array of pointers
     2672to \code{float}; these pointers point into the \code{psImage} data,
     2673offset by the desired column offset.  \code{kernel} point into the
     2674\code{kernelRows}, offset by the desired row offset.  For example:
     2675
     2676\begin{verbatim}
     2677    kernelRows = psAlloc(myImage->nRows * sizeof(float));
     2678    for (int i = 0; i < myImage->nRows; i++) {
     2679        kernelRows[i] = &rows[i][columnOffset];
     2680    }
     2681    kernel = &kernelRows[rowOffset];
     2682\end{verbatim}
     2683
     2684This construction allows the \code{kernel} member to use negative
     2685indices, while preserving the location of \code{psMemBlock}s relative
     2686to allocated memory.
     2687
     2688The maximum extent of the kernel shifts shall be defined by the
     2689\code{xMin}, \code{xMax}, \code{yMin} and \code{yMax} members.  Note
     2690that \code{xMin} and \code{yMin}, under normal circumstances, should
     2691be negative numbers.  That is, \code{myKernel->kernel[-3][-2]} may be
     2692defined if \code{yMin} and \code{xMin} are equal to or more negative
     2693than -3 and -2, respectively.
     2694
     2695Of course, we require the appropriate constructor:
     2696\begin{verbatim}
     2697psKernel *psKernelAlloc(int xMin, int xMax, int yMin, int yMax);
     2698\end{verbatim}
     2699
     2700\code{psKernelAlloc} shall allocate a kernel.  In the event that one
     2701of the minimum values is greater than the corresponding maximum value,
     2702the function shall generate a warning, and the offending values shall
     2703be exchanged.
     2704
     2705\subsubsubsection{Generation of a convolution kernel}
     2706
     2707Given a list of values (e.g., shifts made in the course of OT
     2708guiding), \code{psKernelGenerate} shall return the appropriate kernel.
     2709The API shall be the following:
     2710\begin{verbatim}
     2711psKernel *psKernelGenerate(const psVector *xShifts, const psVector *yShifts);
     2712\end{verbatim}
     2713
     2714The vectors \code{xShifts} and \code{yShifts}, which are a list of
     2715shifts relative to some starting point, will be supplied by the user.
     2716The elements of the vectors should be of an integer type; otherwise
     2717the values shall be truncated to integers.  The output kernel shall be
     2718normalized such that the sum over the kernel is unity.
     2719
     2720If the vectors are not of the same number of elements, then the
     2721function shall generate a warning shall be generated, following which,
     2722the longer vector trimmed to the length of the shorter, and the
     2723function shall continue.
     2724
     2725\subsubsubsection{Convolve an image with the kernel}
     2726
     2727Given an input image and the convolution kernel,
     2728\code{psImageConvolve} shall convolve the input image,
     2729\code{in}, with the kernel, \code{kernel} and return the convolved
     2730image, \code{out}.  The API shall be the following:
     2731\begin{verbatim}
     2732psImage *psImageConvolve(psImage *out, const psImage *in, const psKernel *kernel, bool direct);
     2733\end{verbatim}
     2734
     2735Two methods shall be available for the convolution: if \code{direct}
     2736is \code{true}, then the convolution shall be performed in real space
     2737(appropriate for small kernels); otherwise, the convolution shall be
     2738performed using Fast Fourier Transforms (FFTs; appropriate for larger
     2739kernels).  The latter option involves padding the input image, copying
     2740the kernel into an image of the same size as the padded input image,
     2741performing an FFT on each, multiplying the FFTs, and performing an
     2742inverse FFT before trimming the image back to the original size.
     2743
     2744In the event that \code{out} is \code{NULL}, a new \code{psImage}
     2745shall be allocated and returned.
    26322746
    26332747%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracChangeset for help on using the changeset viewer.