Data Structures | |
| struct | psKernel |
| A convolution kernel. More... | |
Defines | |
| #define | PS_TYPE_KERNEL PS_TYPE_F32 |
| the data member to use for kernel image | |
| #define | PS_TYPE_KERNEL_DATA F32 |
| the data member to use for kernel image | |
| #define | PS_TYPE_KERNEL_NAME "psF32" |
| the data type for kernel as a string | |
Enumerations | |
| enum | psImageCutDirection { PS_CUT_X_POS, PS_CUT_X_NEG, PS_CUT_Y_POS, PS_CUT_Y_NEG } |
Functions | |
| bool | psImageBackground (psStats *stats, const psImage *image, const psImage *mask, psMaskType maskValue, psRandom *rng) |
| psKernel * | psKernelAlloc (int xMin, int xMax, int yMin, int yMax) |
| Allocates a convolution kernel of the given range. | |
| bool | psMemCheckKernel (psPtr ptr) |
| Checks the type of a particular pointer. | |
| psKernel * | psKernelGenerate (const psVector *tShifts, const psVector *xShifts, const psVector *yShifts, bool relative) |
| Generates a kernel given a list of shift values. | |
| psImage * | psImageConvolve (psImage *out, const psImage *in, const psKernel *kernel, bool direct) |
| convolve an image with a kernel | |
| bool | psImageSmooth (psImage *image, double sigma, double Nsigma) |
| Smooths an image by parts using 1D Gaussian independently in x and y. | |
| bool | psImageSmoothMaskF32 (psImage *image, psImage *mask, psMaskType maskVal, double sigma, double Nsigma) |
| psImage * | psImageRebin (psImage *out, const psImage *in, const psImage *mask, psMaskType maskVal, int scale, const psStats *stats) |
| Rebin image to new scale. | |
| psImage * | psImageResample (psImage *out, const psImage *in, int scale, psImageInterpolateMode mode) |
| Resample image to new scale. | |
| psImage * | psImageRotate (psImage *out, const psImage *input, float angle, double complex exposed, psImageInterpolateMode mode) |
| Rotate the input image by given angle, specified in degrees. | |
| psImage * | psImageShift (psImage *out, const psImage *input, float dx, float dy, double complex exposed, psImageInterpolateMode mode) |
| Shift image by an arbitrary number of pixels (dx,dy) in either direction. | |
| psImage * | psImageShiftKernel (psImage *out, const psImage *input, float dx, float dy, psImageInterpolateMode mode) |
| Shift image by an arbitrary number of pixels (dx,dy) in either direction. | |
| psImage * | p_psImageShiftKernel_F32 (psImage *out, const psImage *input, const psImage *kernel) |
| psImage * | psImageRoll (psImage *out, const psImage *input, int dx, int dy) |
| Roll image by an integer number of pixels in either direction. | |
| psImage * | psImageTransform (psImage *output, psPixels **blankPixels, const psImage *input, const psImage *inputMask, psMaskType inputMaskVal, const psPlaneTransform *outToIn, psRegion region, const psPixels *pixels, psImageInterpolateMode mode, double exposedValue) |
| Transform the input image according the supplied transformation. | |
| psImage * | psImageFlip (psImage *output, const psImage *input, bool xFlip, bool yFlip) |
| void | psImageMaskRegion (psImage *image, psRegion region, const char *op, psMaskType maskValue) |
| Sets the bits inside the region, ignoring pixels outside. | |
| void | psImageKeepRegion (psImage *image, psRegion region, const char *op, psMaskType maskValue) |
| Sets the bits outside the region, ignoring pixels inside. | |
| void | psImageMaskCircle (psImage *image, double x, double y, double radius, const char *op, psMaskType maskValue) |
| Sets the bits inside the circle, ignoring the pixels outside. | |
| void | psImageKeepCircle (psImage *image, double x, double y, double radius, const char *op, psMaskType maskValue) |
| Sets the bits outside the circle, ignoring the pixels inside. | |
| psImage * | psImageGrowMask (psImage *out, const psImage *in, psMaskType maskVal, unsigned int growSize, psMaskType growVal) |
| Grows the specified values on the imput mask image, in, returning the result. | |
| psVector * | psImageRow (psVector *out, const psImage *input, int row) |
| Extracts a single complete row from the image and returns it to the provided vector, allocating it if it is NULL. | |
| psVector * | psImageCol (psVector *out, const psImage *input, int column) |
| Extracts a single complete column from the image and returns it to the provided vector, allocating it if it is NULL. | |
| psVector * | psImageSlice (psVector *out, psPixels *coords, const psImage *input, const psImage *mask, psMaskType maskVal, psRegion region, psImageCutDirection direction, const psStats *stats) |
| Extract pixels from rectlinear region to a vector (array of floats). | |
| psVector * | psImageCut (psVector *out, psVector *cutCols, psVector *cutRows, const psImage *input, const psImage *mask, psMaskType maskVal, psRegion region, unsigned int nSamples, psImageInterpolateMode mode) |
| Extract pixels from an image along a line to a vector (array of floats). | |
| psVector * | psImageRadialCut (psVector *out, const psImage *input, const psImage *mask, psMaskType maskVal, float x, float y, const psVector *radii, const psStats *stats) |
| Extract radial region data to a vector. | |
| int | psImageClip (psImage *input, double min, double vmin, double max, double vmax) |
| Clip image values outside of range to given values. | |
| int | psImageClipComplexRegion (psImage *input, double complex min, double complex vmin, double complex max, double complex vmax) |
| Clip image values outside of a specified complex region. | |
| int | psImageClipNaN (psImage *input, float value) |
| Clip NaN image pixels to given value. | |
| int | psImageOverlaySection (psImage *image, const psImage *overlay, int x0, int y0, const char *op) |
| Overlay subregion of image with another image. | |
| psStats * | psImageStats (psStats *stats, const psImage *in, const psImage *mask, psMaskType maskVal) |
| This routine must determine the various statistics for the image. | |
| psHistogram * | psImageHistogram (psHistogram *out, const psImage *in, const psImage *mask, psMaskType maskVal) |
| Construct a histogram from an image (or subimage). | |
| psPolynomial2D * | psImageFitPolynomial (psPolynomial2D *coeffs, const psImage *input) |
| Fit a 2-D polynomial surface to an image. | |
| psImage * | psImageEvalPolynomial (psImage *input, const psPolynomial2D *coeffs) |
| Evaluate a 2-D polynomial surface for the image pixels. | |
| long | psImageCountPixelMask (psImage *mask, psRegion region, psMaskType value) |
| Returns the number of pixels in the image region which satisfy any of the mask bits. | |
| psImage * | psImageSubset (psImage *image, psRegion region) |
| Create a subimage of the specified area. | |
| psImage * | psImageCopy (psImage *output, const psImage *input, psElemType type) |
| Makes a copy of a psImage. | |
| psImage * | psImageTrim (psImage *image, psRegion region) |
| Trim an image. | |
| psImage * | psImageUnbin (psImage *out, const psImage *in, int DX, int DY, int dx, int dy) |
| double | psImageUnbinPixel (const int ix, const int iy, const psImage *in, const int DX, const int DY, const int dx, const int dy) |
| #define PS_TYPE_KERNEL PS_TYPE_F32 |
| #define PS_TYPE_KERNEL_DATA F32 |
| #define PS_TYPE_KERNEL_NAME "psF32" |
| enum psImageCutDirection |
Definition at line 26 of file psImagePixelExtract.h.
| bool psImageBackground | ( | psStats * | stats, | |
| const psImage * | image, | |||
| const psImage * | mask, | |||
| psMaskType | maskValue, | |||
| psRandom * | rng | |||
| ) |
| int psImageClip | ( | psImage * | input, | |
| double | min, | |||
| double | vmin, | |||
| double | max, | |||
| double | vmax | |||
| ) |
Clip image values outside of range to given values.
All pixels with values less than min are set to the value vmin. all pixels with values greater than max are set to the value vmax. This function is defined for psU8, psU16, psS8, psS16, psF32, psF64, psC32, and psC64.
| input | the image to clip |
| min | the minimum image value allowed |
| vmin | the value pixels < min are set to |
| max | the maximum image value allowed |
| vmax | the value pixels > max are set to |
| int psImageClipComplexRegion | ( | psImage * | input, | |
| double complex | min, | |||
| double complex | vmin, | |||
| double complex | max, | |||
| double complex | vmax | |||
| ) |
Clip image values outside of a specified complex region.
All pixels outside of the rectangular region in complex space formed by the min and max input parameters are set to the value vmax (if either the real or imaginary portion exceeds the respective max values), or vmin. This function is defined for psC32, and psC64 imagery only.
| input | the image to clip |
| min | the minimum image value allowed |
| vmin | the value pixels < min are set to |
| max | the maximum image value allowed |
| vmax | the value pixels > max are set to |
| int psImageClipNaN | ( | psImage * | input, | |
| float | value | |||
| ) |
Clip NaN image pixels to given value.
Pixels with NaN, +Inf, or -Inf values are set to the specified value. This function is defined for psF32, psF64, psC32, and psC64.
| input | the image to clip |
| value | the value to set all NaN/Inf values to |
Extracts a single complete column from the image and returns it to the provided vector, allocating it if it is NULL.
| out | specified vector to return |
| input | input image |
| column | column number to extract |
| psImage* psImageConvolve | ( | psImage * | out, | |
| const psImage * | in, | |||
| const psKernel * | kernel, | |||
| bool | direct | |||
| ) |
convolve an image with a kernel
Given an input image and the convolution kernel, psImageConvolve shall convolve the input image, in, with the kernel, kernel and return the convolved image, out.
Two methods shall be available for the convolution: if direct is true, then the convolution shall be performed in real space (appropriate for small kernels); otherwise, the convolution shall be performed using Fast Fourier Transforms (FFTs; appropriate for larger kernels). The latter option involves padding the input image, copying the kernel into an image of the same size as the padded input image, performing an FFT on each, multiplying the FFTs, and performing an inverse FFT before trimming the image back to the original size.
| psImage* psImageCopy | ( | psImage * | output, | |
| const psImage * | input, | |||
| psElemType | type | |||
| ) |
| long psImageCountPixelMask | ( | psImage * | mask, | |
| psRegion | region, | |||
| psMaskType | value | |||
| ) |
Returns the number of pixels in the image region which satisfy any of the mask bits.
An error (eg, invalid image, invalid region) results in a return value of -1. The vector must be U8.
| mask | input image to count |
| region | input region of image |
| value | the mask value to satisfy |
| psVector* psImageCut | ( | psVector * | out, | |
| psVector * | cutCols, | |||
| psVector * | cutRows, | |||
| const psImage * | input, | |||
| const psImage * | mask, | |||
| psMaskType | maskVal, | |||
| psRegion | region, | |||
| unsigned int | nSamples, | |||
| psImageInterpolateMode | mode | |||
| ) |
Extract pixels from an image along a line to a vector (array of floats).
The vector (xs,ys) - (xe,ye) forms the basis of the output vector. Pixels are considered in a rectangular region of width dw about this vector. The input region is collapsed in the perpendicular direction, and each element of the output vector represents pixel-sized boxes, where the value is derived from the statistics of the pixels interpolated along the perpendicular direction. The specific algorithm which must be used is described in the PSLib ADD (PSDC-430-006). The statistic used to derive the output vector value is specified by stats. Only one of the statistics choices may be specified, otherwise the function must return an error. This function must be defined for the following types: psS8, psU16, psF32, psF64.
| out | psVector to recycle, or NULL. |
| cutCols | if not NULL, the calculated column values along the slice (output) |
| cutRows | if not NULL, the calculated row values along the slice (output) |
| input | the input image in which to perform the cut |
| mask | the mask for the input image. |
| maskVal | the mask value to apply to the mask |
| region | the start and end points to cut along |
| nSamples | the number of samples along the cut |
| mode | the interpolation method to use |
| psImage* psImageEvalPolynomial | ( | psImage * | input, | |
| const psPolynomial2D * | coeffs | |||
| ) |
Evaluate a 2-D polynomial surface for the image pixels.
Given the input polynomial coefficients, set the image pixel values on the basis of the polynomial function. This function must be defined for the following types: psS8, psU16, psF32, psF64.
| input | input image |
| coeffs | coefficient structure carries in desired terms |
| psPolynomial2D* psImageFitPolynomial | ( | psPolynomial2D * | coeffs, | |
| const psImage * | input | |||
| ) |
Fit a 2-D polynomial surface to an image.
The input structure coeffs contains the desired order and terms of interest. This function must be defined for the following types: psS8, psU16, psF32, psF64.
| coeffs | coefficient structure carries in desired terms & target |
| input | input image |
| psImage* psImageGrowMask | ( | psImage * | out, | |
| const psImage * | in, | |||
| psMaskType | maskVal, | |||
| unsigned int | growSize, | |||
| psMaskType | growVal | |||
| ) |
Grows the specified values on the imput mask image, in, returning the result.
If out is NULL, then a new image of the same type and dimension as in shall be allocated and returned; otherwise out shall be modified. If out is non- NULL and does not have the same size and type as in, the function shall generate an error and return NULL. Pixels in the in image within growSize pixels (either horizontal or vertical) of a pixel which matches the maskVal shall have the corresponding pixel in the out image set to the growVal.
| out | the image to set and return |
| in | the input to image |
| maskVal | the specified mask value |
| growSize | the range of values from maskVal |
| growVal | the output value to set |
| psHistogram* psImageHistogram | ( | psHistogram * | out, | |
| const psImage * | in, | |||
| const psImage * | mask, | |||
| psMaskType | maskVal | |||
| ) |
Construct a histogram from an image (or subimage).
The histogram to generate is specified by psHistogram hist (see section 4.3.2 in SDRS). This function must be defined for the following types: psS8, psU16, psF32, psF64.
| out | input histogram description & target |
| in | Image data to be histogramed. |
| mask | mask data for image (NULL ok) |
| maskVal | mask Mask for mask |
| void psImageKeepCircle | ( | psImage * | image, | |
| double | x, | |||
| double | y, | |||
| double | radius, | |||
| const char * | op, | |||
| psMaskType | maskValue | |||
| ) |
Sets the bits outside the circle, ignoring the pixels inside.
The pixel values are set by combining the existing pixel value and the given maskValue with a logical operation. The allowed operations are =, AND, OR, and XOR.
| image | the image to set |
| x | the x coordinate of the circle's center |
| y | the y coordinate of the circle's center |
| radius | the radius of the specified circle |
| op | the logical operation |
| maskValue | the specified bits |
| void psImageKeepRegion | ( | psImage * | image, | |
| psRegion | region, | |||
| const char * | op, | |||
| psMaskType | maskValue | |||
| ) |
Sets the bits outside the region, ignoring pixels inside.
The pixels are set by combining the existing pixel value and the given maskValue with a logical operation. The allowed operations are =, AND, OR, and XOR.
| image | the image to set |
| region | the specified region |
| op | the logical operation |
| maskValue | the specified bits |
| void psImageMaskCircle | ( | psImage * | image, | |
| double | x, | |||
| double | y, | |||
| double | radius, | |||
| const char * | op, | |||
| psMaskType | maskValue | |||
| ) |
Sets the bits inside the circle, ignoring the pixels outside.
The pixel values are set by combining the existing pixel value and the given maskValue with a logical operation. The allowed operations are =, AND, OR, and XOR.
| image | the image to set |
| x | the x coordinate of the circle's center |
| y | the y coordinate of the circle's center |
| radius | the radius of the specified circle |
| op | the logical operation |
| maskValue | the specified bits |
| void psImageMaskRegion | ( | psImage * | image, | |
| psRegion | region, | |||
| const char * | op, | |||
| psMaskType | maskValue | |||
| ) |
Sets the bits inside the region, ignoring pixels outside.
The pixels are set by combining the existing pixel value and the given maskValue with a logical operation. The allowed operations are =, AND, OR, and XOR.
| image | the image to set |
| region | the specified region |
| op | the logical operation |
| maskValue | the specified bits |
| int psImageOverlaySection | ( | psImage * | image, | |
| const psImage * | overlay, | |||
| int | x0, | |||
| int | y0, | |||
| const char * | op | |||
| ) |
Overlay subregion of image with another image.
Replace the pixels in the image which correspond to the pixels in OVERLAY with values derived from the IMAGE and OVERLAY based on the given operator OP. Valid operators are "=" (set image value to OVERLAY value), "+" (add OVERLAY value to image value), "-" (subtract OVERLAY from image), "*" (multiply OVERLAY times image), "/" (divide image by OVERLAY). This function is defined for psU8, psS8, psS16, psF32, psF64, psC32, and psC64.
| image | target image |
| overlay | the overlay image |
| x0 | the column to start overlay |
| y0 | the row to start overlay |
| op | the operation to perform for overlay |
| psVector* psImageRadialCut | ( | psVector * | out, | |
| const psImage * | input, | |||
| const psImage * | mask, | |||
| psMaskType | maskVal, | |||
| float | x, | |||
| float | y, | |||
| const psVector * | radii, | |||
| const psStats * | stats | |||
| ) |
Extract radial region data to a vector.
A vector is constructed where each vector elements is derived from the statistics of the pixels which land within one of a sequence of radii. The radii are centered on the image pixel coordinate x,y, and are defined by the sequence of values in the vector radii. The specific algorithm which must be used is described in the PSLib ADD (PSDC-430-006). The statistic used to derive the output vector value is specified by stats. Only one of the statistics choices may be specified, otherwise the function must return an error. This function must be defined for the following types: psS8, psU16, psF32, psF64.
| out | psVector to recycle, or NULL. |
| input | the input image in which to perform the cut |
| mask | the mask for the input image. |
| maskVal | the mask value to apply to the mask |
| x | the column of the center of the cut circle |
| y | the row of the center of the cut circle |
| radii | the radii of the cut circle |
| stats | the statistic to perform in operation |
| psImage* psImageRebin | ( | psImage * | out, | |
| const psImage * | in, | |||
| const psImage * | mask, | |||
| psMaskType | maskVal, | |||
| int | scale, | |||
| const psStats * | stats | |||
| ) |
Rebin image to new scale.
A new image is constructed in which the dimensions are reduced by a factor of 1/scale. The scale, always a positive number, is equal in each dimension and specified the number of pixels used to define a new pixel in the output image. The output image is generated from all input image pixels. This function is defined for psU8, psS8, psS16, psF32, psF64, psC32, and psC64.
| out | an psImage to recycle. If NULL, a new image is created |
| in | input image |
| mask | mask for input image. If NULL, no masking is done. |
| maskVal | the bits to check in mask. |
| scale | the scale to rebin for each dimension |
| stats | the statistic to perform when rebinning. Only one method should be set. |
| psImage* psImageResample | ( | psImage * | out, | |
| const psImage * | in, | |||
| int | scale, | |||
| psImageInterpolateMode | mode | |||
| ) |
Resample image to new scale.
A new image is constructed in which the dimensions are increased by a factor of scale. The scale, always a positive number, is equal in each dimension. The output image is generated from all input image pixels. Each pixel in the output image is derived by interpolating between neighboring pixels using the specified interpolation method (mode).
| out | an psImage to recycle. If NULL, a new image is created |
| in | input image |
| scale | resample scaling factor |
| mode | the interpolation mode used in resampling |
Roll image by an integer number of pixels in either direction.
The output image is the same dimensions as the input image. Edge pixels wrap to the other side (no values are lost). This function is defined for psU8, psS8, psS16, psF32, psF64, psC32, and psC64.
| out | an psImage to recycle. If NULL, a new image is created |
| input | input image |
| dx | number of pixels to roll in the x-dimension |
| dy | number of pixels to roll in the y-dimension |
| psImage* psImageRotate | ( | psImage * | out, | |
| const psImage * | input, | |||
| float | angle, | |||
| double complex | exposed, | |||
| psImageInterpolateMode | mode | |||
| ) |
Rotate the input image by given angle, specified in degrees.
The output image must contain all of the pixels from the input image in their new frame. Pixels in the output image which do not map to input pixels should be set to exposed. The center of rotation is always the center pixel of the image. The rotation is specified in the sense that a positive angle is an anti-clockwise rotation. This function must be defined for the following types: psU8, psU16, psS8, psS16, psF32, psF64, psC32, psC64.
| out | an psImage to recycle. If NULL, a new image is created |
| input | input image |
| angle | the rotation angle in radians. |
| exposed | the output image pixel values for non-imagery areas |
| mode | the interpolation mode used |
Extracts a single complete row from the image and returns it to the provided vector, allocating it if it is NULL.
| out | specified vector to return |
| input | input image |
| row | row number to extract |
| psImage* psImageShift | ( | psImage * | out, | |
| const psImage * | input, | |||
| float | dx, | |||
| float | dy, | |||
| double complex | exposed, | |||
| psImageInterpolateMode | mode | |||
| ) |
Shift image by an arbitrary number of pixels (dx,dy) in either direction.
If the shift values are fractional, the output pixel values should interpolate between the input pixel values. The output image has the same dimensions as the input image. Pixels which fall off the edge of the output image are lost. Newly exposed pixels are set to the value given by exposed. This function must be defined for the following types: psU8, psU16, psS8, psS16, psF32, psF64, psC32, psC64.
| out | an psImage to recycle. If NULL, a new image is created |
| input | input image |
| dx | the shift in x direction. |
| dy | the shift in y direction. |
| exposed | the output image pixel values for non-imagery areas |
| mode | the interpolation mode to use |
| psImage* psImageShiftKernel | ( | psImage * | out, | |
| const psImage * | input, | |||
| float | dx, | |||
| float | dy, | |||
| psImageInterpolateMode | mode | |||
| ) |
Shift image by an arbitrary number of pixels (dx,dy) in either direction.
If the shift values are fractional, the output pixel values should interpolate between the input pixel values. The output image has the same dimensions as the input image. Pixels which fall off the edge of the output image are lost. Newly exposed pixels are set to the value given by exposed. This function must be defined for the following types: psU8, psU16, psS8, psS16, psF32, psF64, psC32, psC64.
This implementation uses a NxN kernel generated based on the interpolation method the image is first shifted by a fractional amount with the kernel, then shifted in place by an integer amount.
XXX the integer shift portion is not implemented XXX the exposed pixels are not properly replaced XXX the algorithm can properly handle a mask, but the API does not include it (and it is not implemented)
| out | an psImage to recycle. If NULL, a new image is created |
| input | input image |
| dx | the shift in x direction. |
| dy | the shift in y direction. |
| mode | the interpolation mode to use |
| psVector* psImageSlice | ( | psVector * | out, | |
| psPixels * | coords, | |||
| const psImage * | input, | |||
| const psImage * | mask, | |||
| psMaskType | maskVal, | |||
| psRegion | region, | |||
| psImageCutDirection | direction, | |||
| const psStats * | stats | |||
| ) |
Extract pixels from rectlinear region to a vector (array of floats).
The output vector contains either col1-col0 or row1-row0 elements, based on the value of the direction: e.g., if direction is PS_CUT_X_POS, there are col1-col0 elements. The region to be sliced is defined by the lower-left corner, (col0,row0), and the upper-right corner, (col1,row1). Note that the row and column of the upper right-hand corner are NOT included in the region. In the event that col1 or row1 are negative, they shall be interpreted as being relative to the size of the parent image in that dimension. The input region is collapsed in the direction perpendicular to that specified by direction, and each element of the output vectors is derived from the statistics of the pixels at that direction coordinate. The statistic used to derive the output vector value is specified by stats. If mask is non-NULL, pixels for which the corresponding mask pixel matches maskVal are excluded from operations. If coords is not NULL, the calculated coordinates along the slice are returned in this vector. Only one of the statistics choices may be specified, otherwise the function must return an error.
This function is defined for the following types: psS8, psU16, psF32, psF64.
| out | psVector to recycle, or NULL. |
| coords | If not NULL, it is populated with the coordinate in the slice dimension coorsponding to the output vector's value of the same position in the vector. This vector maybe resized and retyped as appropriate. |
| input | the input image in which to perform the slice |
| mask | the mask for the input image. |
| maskVal | the mask value to apply to the mask |
| region | the slice region |
| direction | the slice dimension and direction |
| stats | the statistic to perform in slice operation |
| bool psImageSmooth | ( | psImage * | image, | |
| double | sigma, | |||
| double | Nsigma | |||
| ) |
Smooths an image by parts using 1D Gaussian independently in x and y.
Applies a circularly symmetric Gaussian smoothing first in x and then in y directions with just a vector. This process is 2N faster than 2D convolutions (in general).
| image | the image to be smoothed |
| sigma | the width of the smoothing kernel in pixels |
| Nsigma | the size of the smoothing box in sigmas |
| bool psImageSmoothMaskF32 | ( | psImage * | image, | |
| psImage * | mask, | |||
| psMaskType | maskVal, | |||
| double | sigma, | |||
| double | Nsigma | |||
| ) |
| image | the image to be smoothed |
| mask | optional mask |
| sigma | the width of the smoothing kernel in pixels |
| Nsigma | the size of the smoothing box in sigmas |
| psStats* psImageStats | ( | psStats * | stats, | |
| const psImage * | in, | |||
| const psImage * | mask, | |||
| psMaskType | maskVal | |||
| ) |
This routine must determine the various statistics for the image.
Determine statistics for image (or subimage). The statistics to be determined are specified by stats. The mask allows pixels to be excluded if their corresponding mask pixel value matches the value of maskVal. This function must be defined for the following types: psS8, psU16, psF32, psF64.
| stats | defines statistics to be calculated |
| in | image (or subimage) to calculate stats |
| mask | mask data for image (NULL ok) |
| maskVal | mask value for mask |
Create a subimage of the specified area.
Define a subimage of the specified area of the given image. This function must raise an error if the requested subset area lies outside of the parent image and return NULL. The argument image is the parent image, region.x0, region.y0 specify the starting pixel of the subraster, and region.x1,region.y1 specify the extent of the desired subraster. Note that the row and column of this upper right-hand corner NOT included in the region. In the event that x1 or y1 are negative, they shall be interpreted as being relative to the size of the parent image in that dimension. The entire subraster must be contained within the raster of the parent image. Note that the refCounter for the parent should be incremented. This function must be defined for the following types: psU8, psU16, psS8, psS16, psF32, psF64, psC32, psC64.
| image | Parent image. |
| region | region of subimage |
| psImage* psImageTransform | ( | psImage * | output, | |
| psPixels ** | blankPixels, | |||
| const psImage * | input, | |||
| const psImage * | inputMask, | |||
| psMaskType | inputMaskVal, | |||
| const psPlaneTransform * | outToIn, | |||
| psRegion | region, | |||
| const psPixels * | pixels, | |||
| psImageInterpolateMode | mode, | |||
| double | exposedValue | |||
| ) |
Transform the input image according the supplied transformation.
Transform the input image according the supplied transformation. The size of the transformed image is defined by the supplied output image, if non-NULL, or the region otherwise (size region.x1 - region.x0 by region.y1 region.y0, with out->x0 = region.x0 and out->y0 = region.y0). If the inputMask is non-NULL, those pixels in the inputMask matching inputMaskVal are to be ignored in the transformation. The inputMask must be of type psU8, and of the same size as the input, otherwise the function shall generate an error and return NULL. The transformation outToIn specifies the coordinates in the input image of a pixel in the output image — note that this is the reverse of what might be naively expected, but it is what is required in order to use psImagePixelInterpolate. If the pixels array is non-NULL, it shall consist of psPixelCoords, and only those pixels in the output image shall be transformed; otherwise, the entire image is generated. The interpolation is performed using the specified interpolation mode. Where a pixel in the output image does not correspond to a pixel in the input image (or all appropriate pixels in the input image are masked), the value shall be set to exposed, and the pixel added to the appropriate list of pixels (psPixels) in the array of blankPixels for return to the user. This function must be capable of handling the following types for the input (with corresponding types for the output): psF32, psF64.
| output | psImage to recycle, or NULL |
| blankPixels | list of pixels in output image not set, or NULL if no list is desired. |
| input | psImage to apply transform to |
| inputMask | if not NULL, mask of input psImage |
| inputMaskVal | masking value for inputMask |
| outToIn | the transform to apply |
| region | the size of the transformed image |
| pixels | if not NULL, consists of psPixelCoords and specifies which pixels in output image shall be transformed; otherwise, entire image generated |
| mode | the interpolation scheme to be used |
| exposedValue | Exposed value to which non-corresponding pixels are set |
Trim an image.
Trim the specified image in-place, which involves shuffling the pixels around in memory. The pixels in the region [col0:col1,row0:row1] shall consist the output image. The column col1 and row row1 are NOT included in the range. In the event that x1 or y1 are non-positive, they shall be interpreted as being relative to the size of the parent image in that dimension.
If the entire specified subimage is not contained within the parent image, an error results and the return value will be NULL.
N.B. If the input psImage is a child of another psImage, no pixel data will be trimmed, rather it equivalent to calling psImageSubset. If the input psImage is, however, a parent psImage, any children will be obliterated, i.e., freed from memory.
| image | image to trim |
| region | trim region |
| out | Output image |
| in | Input image |
| DY | Scaling factors in x and y |
| dy | Overhang |
| double psImageUnbinPixel | ( | const int | ix, | |
| const int | iy, | |||
| const psImage * | in, | |||
| const int | DX, | |||
| const int | DY, | |||
| const int | dx, | |||
| const int | dy | |||
| ) |
| iy | desired Unbinned point |
| in | binned image |
| DY | Scaling factors in x and y |
| dy | Overhang |
| psKernel* psKernelAlloc | ( | int | xMin, | |
| int | xMax, | |||
| int | yMin, | |||
| int | yMax | |||
| ) |
Allocates a convolution kernel of the given range.
In order to perform a convolution, we need to define the convolution kernel. We need a more general object than a psImage so that we can incorporate the offset from the (0, 0) pixel to the (0, 0) value of the kernel. It might be convenient to allow both positive and negative indices to convey the positive and negative shifts. One might consider setting the x0 and y0 members of a psImage to the appropriate offsets, but this is not the purpose of these members, and doing so may affect the behavior of other psImage operations.
This construction allows the kernel member to use negative indices, while preserving the location of psMemBlocks relative to allocated memory.
The maximum extent of the kernel shifts shall be defined by the xMin, xMax, yMin and yMax members. Note that xMin and yMin, under normal circumstances, should be negative numbers. That is, myKernel->kernel[-3][-2] may be defined if yMin and xMin are equal to or more negative than -3 and -2, respectively.
In the event that one of the minimum values is greater than the corresponding maximum value, the function shall generate a warning, and the offending values shall be exchanged.
| xMin | Most negative x index |
| xMax | Most positive x index |
| yMin | Most negative y index |
| yMax | Most positive y index |
| psKernel* psKernelGenerate | ( | const psVector * | tShifts, | |
| const psVector * | xShifts, | |||
| const psVector * | yShifts, | |||
| bool | relative | |||
| ) |
Generates a kernel given a list of shift values.
Given a list of values (e.g., shifts made in the course of OT guiding), psKernelGenerate shall return the appropriate kernel. The vectors xShifts and yShifts, which are a list of shifts relative to some starting point, will be supplied by the user. The elements of the vectors should be of an integer type; otherwise the values shall be truncated to integers. The output kernel shall be normalized such that the sum over the kernel is unity.
If the vectors are not of the same number of elements, then the function shall generate a warning shall be generated, following which, the longer vector trimmed to the length of the shorter, and the function shall continue.
| tShifts | list of time shifts |
| xShifts | list of x-axis shifts |
| yShifts | list of y-axis shifts |
| relative | specifies the starting point for the shifts; true=relative to previous shift false = relative to some other starting point. |
| bool psMemCheckKernel | ( | psPtr | ptr | ) |
Checks the type of a particular pointer.
Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
| ptr | the pointer whose type to check |
1.5.1