#include "gdal.h"
#include "cpl_minixml.h"
Go to the source code of this file.
Classes | |
struct | GDALTransformerInfo |
struct | OGRContourWriterInfo |
Typedefs | |
typedef int(* | GDALTransformerFunc )(void *pTransformerArg, int bDstToSrc, int nPointCount, double *x, double *y, double *z, int *panSuccess) |
typedef CPLErr(* | GDALContourWriter )(double dfLevel, int nPoints, double *padfX, double *padfY, void *) |
typedef void * | GDALContourGeneratorH |
Functions | |
int | GDALComputeMedianCutPCT (GDALRasterBandH hRed, GDALRasterBandH hGreen, GDALRasterBandH hBlue, int(*pfnIncludePixel)(int, int, void *), int nColors, GDALColorTableH hColorTable, GDALProgressFunc pfnProgress, void *pProgressArg) |
int | GDALDitherRGB2PCT (GDALRasterBandH hRed, GDALRasterBandH hGreen, GDALRasterBandH hBlue, GDALRasterBandH hTarget, GDALColorTableH hColorTable, GDALProgressFunc pfnProgress, void *pProgressArg) |
int | GDALChecksumImage (GDALRasterBandH hBand, int nXOff, int nYOff, int nXSize, int nYSize) |
void * | GDALCreateGenImgProjTransformer (GDALDatasetH hSrcDS, const char *pszSrcWKT, GDALDatasetH hDstDS, const char *pszDstWKT, int bGCPUseOK, double dfGCPErrorThreshold, int nOrder) |
void | GDALSetGenImgProjTransformerDstGeoTransform (void *, const double *) |
void | GDALDestroyGenImgProjTransformer (void *) |
int | GDALGenImgProjTransform (void *pTransformArg, int bDstToSrc, int nPointCount, double *x, double *y, double *z, int *panSuccess) |
void * | GDALCreateReprojectionTransformer (const char *pszSrcWKT, const char *pszDstWKT) |
void | GDALDestroyReprojectionTransformer (void *) |
int | GDALReprojectionTransform (void *pTransformArg, int bDstToSrc, int nPointCount, double *x, double *y, double *z, int *panSuccess) |
void * | GDALCreateGCPTransformer (int nGCPCount, const GDAL_GCP *pasGCPList, int nReqOrder, int bReversed) |
void | GDALDestroyGCPTransformer (void *pTransformArg) |
int | GDALGCPTransform (void *pTransformArg, int bDstToSrc, int nPointCount, double *x, double *y, double *z, int *panSuccess) |
void * | GDALCreateTPSTransformer (int nGCPCount, const GDAL_GCP *pasGCPList, int bReversed) |
void | GDALDestroyTPSTransformer (void *pTransformArg) |
int | GDALTPSTransform (void *pTransformArg, int bDstToSrc, int nPointCount, double *x, double *y, double *z, int *panSuccess) |
void * | GDALCreateRPCTransformer (GDALRPCInfo *psRPC, int bReversed, double dfPixErrThreshold) |
void | GDALDestroyRPCTransformer (void *pTransformArg) |
int | GDALRPCTransform (void *pTransformArg, int bDstToSrc, int nPointCount, double *x, double *y, double *z, int *panSuccess) |
void * | GDALCreateApproxTransformer (GDALTransformerFunc pfnRawTransformer, void *pRawTransformerArg, double dfMaxError) |
void | GDALDestroyApproxTransformer (void *pApproxArg) |
int | GDALApproxTransform (void *pTransformArg, int bDstToSrc, int nPointCount, double *x, double *y, double *z, int *panSuccess) |
int | GDALSimpleImageWarp (GDALDatasetH hSrcDS, GDALDatasetH hDstDS, int nBandCount, int *panBandList, GDALTransformerFunc pfnTransform, void *pTransformArg, GDALProgressFunc pfnProgress, void *pProgressArg, char **papszWarpOptions) |
CPLErr | GDALSuggestedWarpOutput (GDALDatasetH hSrcDS, GDALTransformerFunc pfnTransformer, void *pTransformArg, double *padfGeoTransformOut, int *pnPixels, int *pnLines) |
CPLXMLNode * | GDALSerializeTransformer (GDALTransformerFunc pfnFunc, void *pTransformArg) |
CPLErr | GDALDeserializeTransformer (CPLXMLNode *psTree, GDALTransformerFunc *ppfnFunc, void **ppTransformArg) |
GDALContourGeneratorH | GDAL_CG_Create (int nWidth, int nHeight, int bNoDataSet, double dfNoDataValue, double dfContourInterval, double dfContourBase, GDALContourWriter pfnWriter, void *pCBData) |
CPLErr | GDAL_CG_FeedLine (GDALContourGeneratorH hCG, double *padfScanline) |
void | GDAL_CG_Destroy (GDALContourGeneratorH hCG) |
CPLErr | OGRContourWriter (double, int, double *, double *, void *pInfo) |
CPLErr | GDALContourGenerate (GDALRasterBandH hBand, double dfContourInterval, double dfContourBase, int nFixedLevelCount, double *padfFixedLevels, int bUseNoData, double dfNoDataValue, void *hLayer, int iIDField, int iElevField, GDALProgressFunc pfnProgress, void *pProgressArg) |
|
Generic signature for spatial point transformers. This function signature is used for a variety of functions that accept passed in functions used to transform point locations between two coordinate spaces. The GDALCreateGenImgProjTransformer(), GDALCreateReprojectionTransformer(), GDALCreateGCPTransformer() and GDALCreateApproxTransformer() functions can be used to prepare argument data for some built-in transformers. As well, applications can implement their own transformers to the following signature.
typedef int (*GDALTransformerFunc)( void *pTransformerArg, int bDstToSrc, int nPointCount, double *x, double *y, double *z, int *panSuccess );
|
|
Perform approximate transformation. Actually performs the approximate transformation described in GDALCreateApproxTransformer(). This function matches the GDALTransformerFunc() signature. Details of the arguments are described there. |
|
Compute checksum for image region. Computes a 16bit (0-65535) checksum from a region of raster data on a GDAL supported band. Floating point data is converted to 32bit integer so decimal portions of such raster data will not affect the checksum. Real and Imaginary components of complex bands influence the result.
|
|
Compute optimal PCT for RGB image. This function implements a median cut algorithm to compute an "optimal" pseudocolor table for representing an input RGB image. This PCT could then be used with GDALDitherRGB2PCT() to convert a 24bit RGB image into an eightbit pseudo-colored image. This code was based on the tiffmedian.c code from libtiff (www.libtiff.org) which was based on a paper by Paul Heckbert:
* "Color Image Quantization for Frame Buffer Display", Paul * Heckbert, SIGGRAPH proceedings, 1982, pp. 297-307. * The red, green and blue input bands do not necessarily need to come from the same file, but they must be the same width and height. They will be clipped to 8bit during reading, so non-eight bit bands are generally inappropriate.
|
|
Create vector contours from raster DEM. This algorithm will generate contours vectors for the input raster band on the requested set of contour levels. The vector contours are written to the passed in OGR vector layer. Also, a NODATA value may be specified to identify pixels that should not be considered in contour line generation. The gdal/apps/gdal_contour.cpp mainline can be used as an example of how to use this function. ALGORITHM RULES For contouring purposes raster pixel values are assumed to represent a point value at the center of the corresponding pixel region. For the purpose of contour generation we virtually connect each pixel center to the values to the left, right, top and bottom. We assume that the pixel value is linearly interpolated between the pixel centers along each line, and determine where (if any) contour lines will appear onlong these line segements. Then the contour crossings are connected. This means that contour lines nodes won't actually be on pixel edges, but rather along vertical and horizontal lines connecting the pixel centers.
General Case: 5 | | 3 -- + ---------------- + -- | | | | | | | | 10 + | |\ | | \ | -- + -+-------------- + -- 12 | 10 | 1 Saddle Point: 5 | | 12 -- + -------------+-- + -- | \ | | \| | + | | + | |\ | | \ | -- + -+-------------- + -- 12 | | 1 or: 5 | | 12 -- + -------------+-- + -- | __/ | | ___/ | | ___/ __+ | / __/ | +' __/ | | __/ | | ,__/ | -- + -+-------------- + -- 12 | | 1 Nodata: In the "nodata" case we treat the whole nodata pixel as a no-mans land. We extend the corner pixels near the nodata out to half way and then construct extra lines from those points to the center which is assigned an averaged value from the two nearby points (in this case (12+3+5)/3).
5 | | 3 -- + ---------------- + -- | | | | | 6.7 | | +---------+ 3 10 +___ | | \____+ 10 | | -- + -------+ + 12 | 12 (nodata)
|
|
Create an approximating transformer. This function creates a context for an approximated transformer. Basically a high precision transformer is supplied as input and internally linear approximations are computed to generate results to within a defined precision. The approximation is actually done at the point where GDALApproxTransform() calls are made, and depend on the assumption that the roughly linear. The first and last point passed in must be the extreme values and the intermediate values should describe a curve between the end points. The approximator transforms and center using the approximate transformer, and then compares the true middle transformed value to a linear approximation based on the end points. If the error is within the supplied threshold then the end points are used to linearly approximate all the values otherwise the inputs points are split into two smaller sets, and the function recursively called till a sufficiently small set of points if found that the linear approximation is OK, or that all the points are exactly computed. This function is very suitable for approximating transformation results from output pixel/line space to input coordinates for warpers that operate on one input scanline at a time. Care should be taken using it in other circumstances as little internal validation is done, in order to keep things fast.
|
|
Create GCP based polynomial transformer. Computes least squares fit polynomials from a provided set of GCPs, and stores the coefficients for later transformation of points between pixel/line and georeferenced coordinates. The return value should be used as a TransformArg in combination with the transformation function GDALGCPTransform which fits the GDALTransformerFunc signature. The returned transform argument should be deallocated with GDALDestroyGCPTransformer when no longer needed. This function may fail (returning NULL) if the provided set of GCPs are inadequate for the requested order, the determinate is zero or they are otherwise "ill conditioned". Note that 2nd order requires at least 6 GCPs, and 3rd order requires at least 10 gcps. If nReqOrder is 0 the highest order possible with the provided gcp count will be used.
|
|
Create image to image transformer. This function creates a transformation object that maps from pixel/line coordinates on one image to pixel/line coordinates on another image. The images may potentially be georeferenced in different coordinate systems, and may used GCPs to map between their pixel/line coordinates and georeferenced coordinates (as opposed to the default assumption that their geotransform should be used). This transformer potentially performs three concatenated transformations. The first stage is from source image pixel/line coordinates to source image georeferenced coordinates, and may be done using the geotransform, or if not defined using a polynomial model derived from GCPs. If GCPs are used this stage is accomplished using GDALGCPTransform(). The second stage is to change projections from the source coordinate system to the destination coordinate system, assuming they differ. This is accomplished internally using GDALReprojectionTransform(). The third stage is converting from destination image georeferenced coordinates to destination image coordinates. This is done using the destination image geotransform, or if not available, using a polynomial model derived from GCPs. If GCPs are used this stage is accomplished using GDALGCPTransform(). This stage is skipped if hDstDS is NULL when the transformation is created.
|
|
Create reprojection transformer. Creates a callback data structure suitable for use with GDALReprojectionTransformation() to represent a transformation from one geographic or projected coordinate system to another. On input the coordinate systems are described in OpenGIS WKT format. Internally the OGRCoordinateTransformation object is used to implement the reprojection.
|
|
Create Thin Plate Spline transformer from GCPs. The thin plate spline transformer produces exact transformation at all control points and smoothly varying transformations between control points with greatest influence from local control points. It is suitable for for many applications not well modelled by polynomial transformations. Creating the TPS transformer involves solving systems of linear equations related to the number of control points involved. This solution is computed within this function call. It can be quite an expensive operation for large numbers of GCPs. For instance, for reference, it takes on the order of 10s for 400 GCPs on a 2GHz Athlon processor. TPS Transformers are serializable. The GDAL Thin Plate Spline transformer is based on code provided by Gilad Ronnen on behalf of VIZRT Inc (http://www.visrt.com). Incorporation of the algorithm into GDAL was supported by the Centro di Ecologia Alpina (http://www.cealp.it).
|
|
Cleanup approximate transformer. Deallocates the resources allocated by GDALCreateApproxTransformer().
|
|
Destroy GCP transformer. This function is used to destroy information about a GCP based polynomial transformation created with GDALCreateGCPTransformer().
|
|
GenImgProjTransformer deallocator. This function is used to deallocate the handle created with GDALCreateGenImgProjTransformer().
|
|
Destroy reprojection transformation.
|
|
Destroy TPS transformer. This function is used to destroy information about a GCP based polynomial transformation created with GDALCreateTPSTransformer().
|
|
24bit to 8bit conversion with dithering. This functions utilizes Floyd-Steinberg dithering in the process of converting a 24bit RGB image into a pseudocolored 8bit image using a provided color table. The red, green and blue input bands do not necessarily need to come from the same file, but they must be the same width and height. They will be clipped to 8bit during reading, so non-eight bit bands are generally inappropriate. Likewise the hTarget band will be written with 8bit values and must match the width and height of the source bands.
|
|
Transforms point based on GCP derived polynomial model. This function matches the GDALTransformerFunc signature, and can be used to transform one or more points from pixel/line coordinates to georeferenced coordinates (SrcToDst) or vice versa (DstToSrc).
|
|
Perform general image reprojection transformation. Actually performs the transformation setup in GDALCreateGenImgProjTransformer(). This function matches the signature required by the GDALTransformerFunc(), and more details on the arguments can be found in that topic. |
|
Perform reprojection transformation. Actually performs the reprojection transformation described in GDALCreateReprojectionTransformer(). This function matches the GDALTransformerFunc() signature. Details of the arguments are described there. |
|
Set GenImgProj output geotransform. Normally the "destination geotransform", or transformation between georeferenced output coordinates and pixel/line coordinates on the destination file is extracted from the destination file by GDALCreateGenImgProjTransformer() and stored in the GenImgProj private info. However, sometimes it is inconvenient to have an output file handle with appropriate geotransform information when creating the transformation. For these cases, this function can be used to apply the destination geotransform.
|
|
Perform simple image warp. Copies an image from a source dataset to a destination dataset applying an application defined transformation. This algorithm is called simple because it lacks many options such as resampling kernels (other than nearest neighbour), support for data types other than 8bit, and the ability to warp images without holding the entire source and destination image in memory. The following option(s) may be passed in papszWarpOptions.
|
|
Suggest output file size. This function is used to suggest the size, and georeferenced extents appropriate given the indicated transformation and input file. It walks the edges of the input file (approximately 20 sample points along each edge) transforming into output coordinates in order to get an extents box. Then a resolution is computed with the intent that the length of the distance from the top left corner of the output imagery to the bottom right corner would represent the same number of pixels as in the source image. Note that if the image is somewhat rotated the diagonal taken isnt of the whole output bounding rectangle, but instead of the locations where the top/left and bottom/right corners transform. The output pixel size is always square. This is intended to approximately preserve the resolution of the input data in the output file. The values returned in padfGeoTransformOut, pnPixels and pnLines are the suggested number of pixels and lines for the output file, and the geotransform relating those pixels to the output georeferenced coordinates. The trickiest part of using the function is ensuring that the transformer created is from source file pixel/line coordinates to output file georeferenced coordinates. This can be accomplished with GDALCreateGenImProjTransformer() by passing a NULL for the hDstDS.
|
|
Transforms point based on GCP derived polynomial model. This function matches the GDALTransformerFunc signature, and can be used to transform one or more points from pixel/line coordinates to georeferenced coordinates (SrcToDst) or vice versa (DstToSrc).
|