IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3420


Ignore:
Timestamp:
Mar 14, 2005, 5:00:57 PM (21 years ago)
Author:
Paul Price
Message:

Added psPixels structure, psPixelsToMask, psMaskToPixels,
psPixelsConcatenate and psPixelsTransform. Modified psImageTransform
in preparation for image combination. Added psPlaneTransformDeriv.

Location:
trunk/doc/pslib
Files:
2 edited

Legend:

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

    r3340 r3420  
    1 %%% $Id: ChangeLogSDRS.tex,v 1.72 2005-02-28 21:37:15 price Exp $
     1%%% $Id: ChangeLogSDRS.tex,v 1.73 2005-03-15 03:00:52 price Exp $
    22
    33\subsection{Changes from version 00 to version 01}
     
    481481  from a file.
    482482\item \code{psMetadataAddV} changed to use \code{va_list} parameter (bug 312).
    483 \end{itemize}
     483\item Added \code{psPixels} structure, \code{psPixelsToMask},
     484  \code{psMaskToPixels}, \code{psPixelsConcatenate} and
     485  \code{psPixelsTransform}.
     486\item Modified \code{psImageTransform} in preparation for image combination.
     487\item Added \code{psPlaneTransformDeriv}.
     488\end{itemize}
  • trunk/doc/pslib/psLibSDRS.tex

    r3340 r3420  
    1 %%% $Id: psLibSDRS.tex,v 1.184 2005-02-28 21:36:35 price Exp $
     1%%% $Id: psLibSDRS.tex,v 1.185 2005-03-15 03:00:57 price Exp $
    22\documentclass[panstarrs,spec]{panstarrs}
    33
     
    28462846
    28472847\begin{verbatim}
     2848// Transform an image --- different from current version, nothing major
     2849psImage *psImageTransform(psImage *output, psPixels **blankPixels, const psImage *input,
     2850                          const psImage *inputMask, int inputMaskVal, const psPlaneTransform *outToIn,
     2851                          const psRegion *region, const psPixels *pixels, psImageInterpolateMode mode,
     2852                          double exposedValue);
     2853\begin{verbatim}
    28482854psImage *psImageTransform(psImage *output, const psImage *input, const psImage *inputMask, int inputMaskVal,
    28492855                          const psPlaneTransform *outToIn, const psImage *combineMask, int combineMaskVal);
    28502856\end{verbatim}
    28512857Transform the \code{input} image according the supplied
    2852 transformation.  In the event that the \code{output} is \code{NULL},
    2853 the smallest possible image capable of containing the entire
    2854 transformed \code{input} image is to be returned; otherwise only the
    2855 image size specified in the \code{output} image is to be used.  If the
    2856 \code{inputMask} is not \code{NULL}, those pixels in the
     2858transformation.  The size of the transformed image is defined by the
     2859supplied \code{output} image, if non-\code{NULL}, or the \code{region}
     2860otherwise (size \code{region->x1 - region->x0} by \code{region->y1 -
     2861region->y0}, with \code{out->x0 = region->x0} and \code{out->y0 =
     2862region->y0}).
     2863
     2864If the \code{inputMask} is non-\code{NULL}, those pixels in the
    28572865\code{inputMask} matching \code{inputMaskVal} are to be ignored in the
    28582866transformation.  The \code{inputMask} must be of type \code{psU8}, and
     
    28622870in the output image --- note that this is the reverse of what might be
    28632871naively expected, but it is what is required in order to use
    2864 \code{psImagePixelInterpolate}.  If \code{combineMask} is not
    2865 \code{NULL}, then those pixels that match \code{combineMaskVal} are
    2866 not transformed.  \code{combineMask} must be of type \code{psU8} and
    2867 of the same size as the \code{output}, otherwise the function shall
    2868 generate an error and return \code{NULL}.  This function must be
     2872\code{psImagePixelInterpolate}.  If \code{pixels} is non-\code{NULL},
     2873then only those pixels in the output image are transformed; otherwise,
     2874the entire image is generated.  The interpolation is performed using
     2875the specified interpolation \code{mode}.  Where a pixel in the output
     2876image does not correspond to a pixel in the input image (or all
     2877appropriate pixels in the input image are masked), the value shall be
     2878set to \code{exposed}, and the pixel added to the list of
     2879\code{blankPixels} for return to the user.  This function must be
    28692880capable of handling the following types for the \code{input} (with
    28702881corresponding types for the \code{output}): \code{psF32},
     
    48754886the fit shall be rejected.
    48764887
     4888\paragraph{Derivatives}
     4889
     4890In order to simply calculate which pixels in one coordinate frame
     4891overlap those in another coordinate frame tied by a
     4892\code{psPlaneTransform}, we need to calculate the derivative of a
     4893transformation with respect to each coordinate.
     4894
     4895\begin{verbatim}
     4896psPlane *psPlaneTransformDeriv(psPlane *out, const psPlaneTransform *transformation, const psPlane *coord);
     4897\end{verbatim}
     4898
     4899\code{psPlaneTransformDeriv} shall return the derivatives of the
     4900\code{transformation} at the specified coordinates, \code{coord}.
     4901Both the derivatives with respect to $x$ and $y$ shall be returned.
     4902If \code{out} is non-\code{NULL}, it shall be modified and returned;
     4903otherwise a new \code{psPlane} shall be allocated and returned.  In
     4904the event that either \code{transformation} or \code{coord} are
     4905\code{NULL}, the function shall generate an error and return
     4906\code{NULL}.
     4907
     4908
    48774909\subsubsection{Celestial Coordinate Conversions}
    48784910
     
    50325064%%% Astronomical Images and Astrometry
    50335065\include{psLibSDRS_Astrom}
     5066
     5067%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     5068
     5069\subsection{Pixel Lists}
     5070
     5071Usually an image mask is the best way to carry information about what
     5072pixels mean what.  However, in the case where the number of pixels in
     5073which we are interested is limited, it is more efficient to simply
     5074carry a list of pixels.  An example of this is in the image
     5075combination code, where we want to perform an operation on a
     5076relatively small fraction of pixels, and it is inefficient to go
     5077through an entire mask image checking each pixel.
     5078
     5079\begin{verbatim}
     5080typedef struct {
     5081    psVector *x;                        // x coordinate
     5082    psVector *y;                        // y coordinate
     5083} psPixels;
     5084\end{verbatim}
     5085
     5086Of course, the size of each of the vectors should match.  In the event
     5087that they do not match, any function which detects the problem shall
     5088generate a warning and use the size of the shorter of the vectors as
     5089the size.  The order in which the pixels are kept is not considered
     5090important.
     5091
     5092\begin{verbatim}
     5093psImage *psPixelsToMask(psImage *out, const psPixels *pixels, const psRegion *region, unsigned int maskVal);
     5094psPixels *psMaskToPixels(psPixels *out, const psImage *mask, unsigned int maskVal);
     5095\end{verbatim}
     5096
     5097\code{psPixelsToMask} shall return an image of type U8 with the
     5098\code{pixels} lying within the specified \code{region} set to the
     5099\code{maskVal}.  The \code{out} image shall be modified if supplied,
     5100or allocated and returned if \code{NULL}.  The size of the output
     5101image shall be \code{region->x1 - region->x0} by \code{region->y1 -
     5102region->y0}, with \code{out->x0 = region->x0} and \code{out->y0 =
     5103region->y0}.  In the event that either of \code{pixels} or
     5104\code{region} are \code{NULL}, the function shall generate an error
     5105and return \code{NULL}.
     5106
     5107\code{psMaskToPixels} shall return a \code{psPixels} consisting of the
     5108coordinates in the \code{mask} that match the \code{maskVal}.  The
     5109\code{out} pixel list shall be modified if supplied, or allocated and
     5110returned if \code{NULL}.  In hte event that \code{mask} is
     5111\code{NULL}, the function shall generate an error and return
     5112\code{NULL}.
     5113
     5114\begin{verbatim}
     5115psPixels *psPixelsConcatenate(psPixels *out, const psPixels *pixels);
     5116\end{verbatim}
     5117
     5118\code{psPixelsConcatenate} shall concatenate \code{pixels} onto
     5119\code{out}.  In the event that \code{out} is \code{NULL}, a new
     5120\code{psPixels} shall be allocated, and the contents of \code{pixels}
     5121simply copied in.  If \code{pixels} is \code{NULL}, the function shall
     5122generate an error and return \code{NULL}.  The function shall take
     5123care to ensure that there are no duplicate pixels in \code{out} (since
     5124the order in which the pixels are stored is not important, the values
     5125may be sorted, allowing the use of a faster algorithm than a linear
     5126scan).
     5127
     5128\begin{verbatim}
     5129psPixels *psPixelsTransform(psPixels *out, const psPixels *input, const psPlaneTransform *inToOut);
     5130\end{verbatim}
     5131
     5132\code{psPixelsTransform} shall generate a list of pixels in the output
     5133coordinate frame that overlap the \code{input} pixels in the input
     5134coordinate frame through the specified transformation, \code{inToOut}.
     5135Note that this is more complicated than simply transforming the
     5136\code{input} pixels, but requires the evaluation of the derivatives of
     5137the transformation in order to obtain the list of all pixels in the
     5138output coordinate frame that possibly overlap the pixel in the input
     5139coordinate frame (assuming that $x' + \Delta x' = f(x) + \Delta x
     5140\times \partial f(x) / \partial x$, where $x'$ is the coordinate in
     5141the output coordinate frame, $\Delta x'$ is the size of the region in
     5142the output coordinate frame in the positive direction that overlaps
     5143the input pixel, $x$ is the coordinate in the input coordinate frame,
     5144$f(x)$ is the transformation from the input to the output coordinate
     5145frames, and $\Delta x$ is the size of a pixel; care should be taken
     5146with half-pixel problems).  In the event that \code{input} or
     5147\code{inToOut} are \code{NULL}, the function shall generate an error
     5148and return \code{NULL}.
    50345149
    50355150%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracChangeset for help on using the changeset viewer.