Skip to main content

I need help with this code

1 reply [Last post]
nanr7dx
Offline
Joined: 2006-02-17

Hello. please see the next code (in: a JAI image and number of RGB band. Out: a Matrix):

[b][i]
public static double[][] getMatrixBand (PlanarImage pi, int band) {
double [][] doble = new double [pi.getHeight()][pi.getWidth()];
for (int c=0 ; c

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
aastha
Offline
Joined: 2004-04-19

If the PlanarImage that you are extracting sample data from, is an image containing multiple tiles, then calling the copyData() method will cause the execution to slow down. This is because the copyData() method creates a Raster that is large enough to hold all the image's data, and then copies data from each individual image tile to the large Raster. Obviously all this copying will slow down the execution.

To see whether your PlanarImage contains tiles, use the PlanarImage.getNumXTiles() and PlanarImage.getNumXTiles() methods. If the image has more than 1 tile in each direction, it will be more efficient to use the PlanarImage.getTile() method for each tile, and then use the getSampleDouble() method on each returned tile instead of using the copyData() method.

Hope this helps,

Aastha