Class ConfigGridCoefND
java.lang.Object
org.ddogleg.chainrule.grid.ConfigGridCoefND
- All Implemented Interfaces:
MapFormattable
Configuration for a polynomial grid where each cell in the grid has a numOut polynomials with coefs
coefficients each.
Padding says how many of the outermost rows and columns sit outside the image. The totals do not change,
so neither does dof() or where anything lives in the parameter array. What changes is the coordinate
transform: the interior shrinks to cols - 2*padding knots and the cells grow to match, which buys
coverage for points outside the image at the cost of resolution inside it.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionintNumber of coefficients in each output polynomialintNumber of columns and rows in the grid, padding includedstatic final intHow many weights are produced, one per knot of the cellintNumber of outputs for cellintHow many of the outermost rows and columns lie outside the imageintNumber of columns and rows in the grid, padding included -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intcellIndex(double gridCoor, int count) Cell a fractional grid coordinate falls in.voidMakes sure valid values have been entered for all parameters.voidcheckValid(int minAxis) checkValid()with the per-axis knot minimum given.intdof()Number of parameters needed to describe this polynomial gridformatMap(MapPrintFormat format) booleanTrue if every field matches exactlyvoidknotOffsets(int col, int row, int offset, int[] knotOffsets) Where each of a cell's four knots starts in the parameter arrayintHow many parameters one knot holdsstatic intnearestIndex(double pixel, int count, int size) Knot a pixel is nearest to when the axis tiles the image ascountequal bands rather than a bilinear lattice of corner knots: bandkowns[k*size/count, (k+1)*size/count), so the knot sits at the band's center.doublepixelToGridX(double pixelX, int width) Fractional grid coordinate of a pixel, where a whole number is a knot.doublepixelToGridY(double pixelY, int height) reset()Resets parameters to an invalid value so you will know if they have been initialledsetTo(ConfigGridCoefND src) toString()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface MapFormattable
formatMap
-
Field Details
-
NUM_KNOTS
public static final int NUM_KNOTSHow many weights are produced, one per knot of the cell- See Also:
-
cols
public int colsNumber of columns and rows in the grid, padding included -
rows
public int rowsNumber of columns and rows in the grid, padding included -
coefs
public int coefsNumber of coefficients in each output polynomial -
numOut
public int numOutNumber of outputs for cell -
padding
public int paddingHow many of the outermost rows and columns lie outside the image
-
-
Constructor Details
-
ConfigGridCoefND
public ConfigGridCoefND()
-
-
Method Details
-
checkValid
public void checkValid()Makes sure valid values have been entered for all parameters. Two knots per axis is the minimum a bilinear read needs, which is what every consumer here does -
checkValid
public void checkValid(int minAxis) checkValid()with the per-axis knot minimum given. Bilinear needs 2, but a nearest-neighbor field reads a single knot and so can run on a 1x1 grid -
reset
Resets parameters to an invalid value so you will know if they have been initialled -
setTo
-
isIdentical
True if every field matches exactly -
dof
public int dof()Number of parameters needed to describe this polynomial grid -
knotStride
public int knotStride()How many parameters one knot holds -
pixelToGridX
public double pixelToGridX(double pixelX, int width) Fractional grid coordinate of a pixel, where a whole number is a knot.0andwidthland on the first and last knot inside the image, which padding moves inwards -
pixelToGridY
public double pixelToGridY(double pixelY, int height) - See Also:
-
cellIndex
public static int cellIndex(double gridCoor, int count) Cell a fractional grid coordinate falls in. The last knot along an axis starts no cell of its own, and a coordinate outside the grid is given the nearest cell to extrapolate from -
nearestIndex
public static int nearestIndex(double pixel, int count, int size) Knot a pixel is nearest to when the axis tiles the image ascountequal bands rather than a bilinear lattice of corner knots: bandkowns[k*size/count, (k+1)*size/count), so the knot sits at the band's center. UnlikecellIndex(double, int)every knot owns a band and the result spans[0, count-1]. Padding plays no part; the bands cover the whole image -
knotOffsets
public void knotOffsets(int col, int row, int offset, int[] knotOffsets) Where each of a cell's four knots starts in the parameter array- Parameters:
col- Column of the cell's low cornerrow- Row of the cell's low corneroffset- Where this grid's parameters start in the arrayknotOffsets- Output, the four locations in the orderCROperatorGridBilinearWeightsexpects
-
formatMap
- Specified by:
formatMapin interfaceMapFormattable
-
toString
-