Changeset 1415
- Timestamp:
- Aug 6, 2004, 6:11:59 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/doc/pslib/psLibSDRS.tex (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/pslib/psLibSDRS.tex
r1400 r1415 1 %%% $Id: psLibSDRS.tex,v 1.6 2 2004-08-06 19:06:36 eugene Exp $1 %%% $Id: psLibSDRS.tex,v 1.63 2004-08-07 04:11:59 price Exp $ 2 2 \documentclass[panstarrs,spec]{panstarrs} 3 3 … … 32 32 01 & 2004 May 19 & Extensive modifications, see appendix \\ \hline 33 33 02 & 2004 Jun 22 & Incorporation of Bugzilla PRs (up to 69) \\ \hline 34 03 & 2004 Aug 06 & Adding convolution, splines, chebyshevs \\ 35 & & (modified polynomials), ImageTrim for Phase 2 \\ \hline 34 36 \RevisionsEnd 35 37 … … 1885 1887 \subsection{Analytical functions} 1886 1888 1887 \subsubsection{ GeneralPolynomials}1889 \subsubsection{Polynomials} 1888 1890 1889 1891 PSLib provides APIs to represent and interact with polynomials in up … … 2630 2632 psImage *psImagePowerSpectrum(psImage *out, const psImage *in); 2631 2633 \end{verbatim} 2634 2635 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2636 2637 \subsubsection{Convolution} 2638 2639 Convolution will be an essential operation for the IPP. For example, 2640 if images on the sky are obtained in Orthogonal Transfer (OT) mode, 2641 then the calibration frames used to correct them must be convolved by 2642 a kernel derived from the list of OT shifts made during the exposure. 2643 Also, convolution is also required for object detection and 2644 PSF-matching. 2645 2646 \subsubsubsection{Kernel definition} 2647 2648 In order to perform a convolution, we need to define the convolution 2649 kernel. We need a more general object than a \code{psImage} so that 2650 we can incorporate the offset from the $(0,0)$ pixel to the $(0,0)$ 2651 value of the kernel. It might be convenient to allow both positive 2652 and negative indices to convey the positive and negative shifts. One 2653 might consider setting the \code{x0} and \code{y0} members of a 2654 \code{psImage} to the appropriate offsets, but this is not the purpose 2655 of 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 */ 2660 typedef 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 2669 The kernel data is carried primarily by the \code{data} member which 2670 is a normal \code{psImage}. In order to allow negative indices, we 2671 add two additional members. \code{kernelRows} is an array of pointers 2672 to \code{float}; these pointers point into the \code{psImage} data, 2673 offset 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 2684 This construction allows the \code{kernel} member to use negative 2685 indices, while preserving the location of \code{psMemBlock}s relative 2686 to allocated memory. 2687 2688 The maximum extent of the kernel shifts shall be defined by the 2689 \code{xMin}, \code{xMax}, \code{yMin} and \code{yMax} members. Note 2690 that \code{xMin} and \code{yMin}, under normal circumstances, should 2691 be negative numbers. That is, \code{myKernel->kernel[-3][-2]} may be 2692 defined if \code{yMin} and \code{xMin} are equal to or more negative 2693 than -3 and -2, respectively. 2694 2695 Of course, we require the appropriate constructor: 2696 \begin{verbatim} 2697 psKernel *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 2701 of the minimum values is greater than the corresponding maximum value, 2702 the function shall generate a warning, and the offending values shall 2703 be exchanged. 2704 2705 \subsubsubsection{Generation of a convolution kernel} 2706 2707 Given a list of values (e.g., shifts made in the course of OT 2708 guiding), \code{psKernelGenerate} shall return the appropriate kernel. 2709 The API shall be the following: 2710 \begin{verbatim} 2711 psKernel *psKernelGenerate(const psVector *xShifts, const psVector *yShifts); 2712 \end{verbatim} 2713 2714 The vectors \code{xShifts} and \code{yShifts}, which are a list of 2715 shifts relative to some starting point, will be supplied by the user. 2716 The elements of the vectors should be of an integer type; otherwise 2717 the values shall be truncated to integers. The output kernel shall be 2718 normalized such that the sum over the kernel is unity. 2719 2720 If the vectors are not of the same number of elements, then the 2721 function shall generate a warning shall be generated, following which, 2722 the longer vector trimmed to the length of the shorter, and the 2723 function shall continue. 2724 2725 \subsubsubsection{Convolve an image with the kernel} 2726 2727 Given 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 2730 image, \code{out}. The API shall be the following: 2731 \begin{verbatim} 2732 psImage *psImageConvolve(psImage *out, const psImage *in, const psKernel *kernel, bool direct); 2733 \end{verbatim} 2734 2735 Two methods shall be available for the convolution: if \code{direct} 2736 is \code{true}, then the convolution shall be performed in real space 2737 (appropriate for small kernels); otherwise, the convolution shall be 2738 performed using Fast Fourier Transforms (FFTs; appropriate for larger 2739 kernels). The latter option involves padding the input image, copying 2740 the kernel into an image of the same size as the padded input image, 2741 performing an FFT on each, multiplying the FFTs, and performing an 2742 inverse FFT before trimming the image back to the original size. 2743 2744 In the event that \code{out} is \code{NULL}, a new \code{psImage} 2745 shall be allocated and returned. 2632 2746 2633 2747 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note:
See TracChangeset
for help on using the changeset viewer.
