Home   Notes   Contact Me

JAI

Local

External


RenderedImage, getting one from a Raster

RenderedImage getRenderedImage(WritableRaster raster) { ColorModel colorModel = PlanarImage.createColorModel(raster.getSampleModel()); BufferedImage bi = new BufferedImage(colorModel, raster, true, null); return bi; }

WarpQuadradic

Coefficents

x' = p(x, y) = c1 + c2*x + c3*y + c4*x^2 + c5*x*y + c6*y^2 y' = q(x, y) = c7 + c8*x + c9*y + c10*x^2 + c11*x*y + c12*y^2

Eclipse Detail Formatter

#For class: javax.media.jai.WarpQuadratic return String.format( "x = %+2.2f x(%+2.2f) y(%+2.2f) x^2(%+2.2f) xy(%+2.2f) y^2(%+2.2f)\n" + "y = %+2.2f x(%+2.2f) y(%+2.2f) x^2(%+2.2f) xy(%+2.2f) y^2(%+2.2f)", this.c1, this.c2, this.c3, this.c4, this.c5, this.c6, this.c7, this.c8, this.c9, this.c10, this.c11, this.c12);

Load a File

File f = new File("image.tif"); BufferedImage bi = ImageIO.read(f);

Out of Memory on file open

I was getting out of memory problems when openning a very large image file with this:
ImageIO.read(new File(filename))
It works fine with this:
JAI.create(filename);

Operators

Table 3-1 Point Operators
Operator Description Reference
Absolute
Takes one rendered or renderable source image, and computes the mathematical absolute value of each pixel.
page 177
Add
Takes two rendered or renderable source images, and adds every pair of pixels, one from each source image of the corresponding position and band.
page 166
AddCollection
Takes a collection of rendered source images, and adds every pair of pixels, one from each source image of the corresponding position and band.
page 168
AddConst
Takes a collection of rendered images and an array of double constants, and for each rendered image in the collection adds a constant to every pixel of its corresponding band.
page 167
AddConstToCollection Takes a collection of rendered images and an array of double constants, and for each rendered image in the collection adds a constant to every pixel of its corresponding band.
page 169
And
Takes two rendered or renderable source images and performs a bit-wise logical AND on every pair of pixels, one from each source image, of the corresponding position and band.
page 158
AndConst
Takes one rendered or renderable source image and an array of integer constants, and performs a bit-wise logical AND between every pixel in the same band of the source and the constant from the corresponding array entry.
page 159
BandCombine
Takes one rendered or renderable source image and computes a set of arbitrary linear combinations of the bands using a specified matrix.
page 141
BandSelect
Takes one rendered or renderable source image, chooses N bands from the image, and copies the pixel data of these bands to the destination image in the order specified.
page 185
Clamp
Takes one rendered or renderable source image and sets all the pixels whose value is below a low value to that low value and all the pixels whose value is above a high value to that high value. The pixels whose value is between the low value and the high value are left unchanged.
page 184
ColorConvert
Takes one rendered or renderable source image and performs a pixel-by-pixel color conversion of the data.
page 140
Composite
Takes two rendered or renderable source images and combines the two images based on their alpha values at each pixel.
page 243
Constant
Takes one rendered or renderable source image and creates a multi-banded, tiled rendered image, where all the pixels from the same band have a constant value.
page 123
Divide
Takes two rendered or renderable source images, and for every pair of pixels, one from each source image of the corresponding position and band, divides the pixel from the first source by the pixel from the second source.
page 171
DivideByConst
Takes one rendered source image and divides the pixel values of the image by a constant.
page 172
DivideComplex
Takes two rendered or renderable source images representing complex data and divides them.
page 174
DivideIntoConst
Takes one rendered or renderable source image and an array of double constants, and divides every pixel of the same band of the source into the constant from the corresponding array entry.
page 173
Exp
Takes one rendered or renderable source image and computes the exponential of the pixel values.
page 177
Invert
Takes one rendered or renderable source image and inverts the pixel values.
page 241
Log
Takes one rendered or renderable source image and computes the natural logarithm of the pixel values. The operation is done on a per-pixel, per-band basis. For integral data types, the result will be rounded and clamped as needed.
page 241
Lookup
Takes one rendered or renderable source image and a lookup table, and performs general table lookup by passing the source image through the table.
page 205
MatchCDF
Takes one rendered or renderable source image and performs a piecewise linear mapping of the pixel values such that the Cumulative Distribution Function (CDF) of the destination image matches as closely as possible a specified Cumulative Distribution Function.
page 203
Max
Takes two rendered or renderable source images, and for every pair of pixels, one from each source image of the corresponding position and band, finds the maximum pixel value.
page 156
Min
Takes two rendered or renderable source images and for every pair of pixels, one from each source image of the corresponding position and band, finds the minimum pixel value.
page 157
Multiply
Takes two rendered or renderable source images, and multiplies every pair of pixels, one from each source image of the corresponding position and band.
page 174
MultiplyComplex
Takes two rendered source images representing complex data and multiplies the two images.
page 176
MultiplyConst
Takes one rendered or renderable source image and an array of double constants, and multiplies every pixel of the same band of the source by the constant from the corresponding array entry.
page 175
Not
Takes one rendered or renderable source image and performs a bit-wise logical NOT on every pixel from every band of the source image.
page 164
Or
Takes two rendered or renderable source images and performs bit-wise logical OR on every pair of pixels, one from each source image of the corresponding position and band.
page 160
OrConst
Takes one rendered or renderable source image and an array of integer constants, and performs a bit-wise logical OR between every pixel in the same band of the source and the constant from the corresponding array entry.
page 161
Overlay
Takes two rendered or renderable source images and overlays the second source image on top of the first source image.
page 242
Pattern
Takes a rendered source image and defines a tiled image consisting of a repeated pattern.
page 80
Piecewise
Takes one rendered or renderable source image and performs a piecewise linear mapping of the pixel values.
page 202
Rescale
Takes one rendered or renderable source image and maps the pixel values of an image from one range to another range by multiplying each pixel value by one of a set of constants and then adding another constant to the result of the multiplication.
page 200
Subtract
Takes two rendered or renderable source images, and for every pair of pixels, one from each source image of the corresponding position and band, subtracts the pixel from the second source from the pixel from the first source.
page 169
SubtractConst
Takes one rendered or renderable source image and an array of double constants, and subtracts a constant from every pixel of its corresponding band of the source.
page 170
SubtractFromConst
Takes one rendered or renderable source image and an array of double constants, and subtracts every pixel of the same band of the source from the constant from the corresponding array entry.
page 171
Threshold
Takes one rendered or renderable source image, and maps all the pixels of this image whose value falls within a specified range to a specified constant.
page 245
Xor
Takes two rendered or renderable source images, and performs a bit-wise logical XOR on every pair of pixels, one from each source image of the corresponding position and band.
page 162
XorConst
Takes one rendered or renderable source image and an array of integer constants, and performs a bit-wise logical XOR between every pixel in the same band of the source and the constant from the corresponding array entry.
page 163