当前位置: 首页>>代码示例>>Java>>正文


Java PlanarImage.getMinX方法代码示例

本文整理汇总了Java中javax.media.jai.PlanarImage.getMinX方法的典型用法代码示例。如果您正苦于以下问题:Java PlanarImage.getMinX方法的具体用法?Java PlanarImage.getMinX怎么用?Java PlanarImage.getMinX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.media.jai.PlanarImage的用法示例。


在下文中一共展示了PlanarImage.getMinX方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: OrbitTiledImagePlanarImage

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
public OrbitTiledImagePlanarImage(PlanarImage image) throws Exception {
        super("");
        this.image = image;
        this.width = image.getWidth();
        this.height = image.getHeight();
        this.tileWidth = image.getTileWidth();
        this.tileHeight = image.getTileHeight();
        this.tileGridXOffset = image.getTileGridXOffset();
        this.tileGridYOffset = image.getTileGridYOffset();
        this.minX = image.getMinX();
        this.minY = image.getMinY();
        this.numBands = image.getNumBands();

        this.colorModel = image.getColorModel();
        this.sampleModel = image.getSampleModel();

//		if (numBands==1) this.colorModel = grayColorModel; else
//		{
//			this.colorModel = rgbColorModel;
//		}

//		this.colorModel = rgbColorModel; // an OrbitTiledImage is always a RGB image
//		this.sampleModel = colorModel.createCompatibleSampleModel(tileWidth, tileHeight);

        // bugfix 20.04.2012 Manuel: colorModel is now always defined by input image (overview image problem)
        this.colorModel = image.getColorModel();
        this.sampleModel = image.getSampleModel();
        this.filename = "PlanarImage " + image.hashCode();
        // better set useCache always to false here???
    }
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:31,代码来源:OrbitTiledImagePlanarImage.java

示例2: computeRectByte

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
private void computeRectByte(PlanarImage src, RasterAccessor dst) {
       RandomIter iter = RandomIterFactory.create(src, src.getBounds());

       int minX = src.getMinX();
       int maxX = src.getMaxX();
       int minY = src.getMinY();
       int maxY = src.getMaxY();

       int dstWidth = dst.getWidth();
       int dstHeight = dst.getHeight();
       int dstBands = dst.getNumBands();

       int lineStride = dst.getScanlineStride();
       int pixelStride = dst.getPixelStride();
       int[] bandOffsets = dst.getBandOffsets();
       byte[][] data = dst.getByteDataArrays();

       float[] warpData = new float[2 * dstWidth];

       int lineOffset = 0;

byte[] backgroundByte = new byte[dstBands];
for (int i = 0; i < dstBands; i++)
    backgroundByte[i] = (byte)backgroundValues[i];

       for (int h = 0; h < dstHeight; h++) {
           int pixelOffset = lineOffset;
           lineOffset += lineStride;

           warp.warpRect(dst.getX(), dst.getY()+h, dstWidth, 1,
                         warpData);
           int count = 0;
           for (int w = 0; w < dstWidth; w++) {
               /*
                * The warp object subtract 0.5 from backward mapped
                * source coordinate. Need to do a round to get the
                * nearest neighbor. This is different from the standard
                * nearest implementation.
                */
               int sx = round(warpData[count++]);
               int sy = round(warpData[count++]);

               if (sx < minX || sx >= maxX || sy < minY || sy >= maxY) {
                   /* Fill with a background color. */
                   if (setBackground) {
                       for (int b = 0; b < dstBands; b++) {
                           data[b][pixelOffset+bandOffsets[b]] =
                               backgroundByte[b];
                       }
                   }
               } else {
                   for (int b = 0; b < dstBands; b++) {
                       data[b][pixelOffset+bandOffsets[b]] =
                           (byte)(iter.getSample(sx, sy, b) & 0xFF);
                   }
               }

               pixelOffset += pixelStride;
           }
       }
   }
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:62,代码来源:WarpNearestOpImage.java

示例3: computeRectUShort

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
private void computeRectUShort(PlanarImage src, RasterAccessor dst) {
       RandomIter iter = RandomIterFactory.create(src, src.getBounds());

       int minX = src.getMinX();
       int maxX = src.getMaxX();
       int minY = src.getMinY();
       int maxY = src.getMaxY();

       int dstWidth = dst.getWidth();
       int dstHeight = dst.getHeight();
       int dstBands = dst.getNumBands();

       int lineStride = dst.getScanlineStride();
       int pixelStride = dst.getPixelStride();
       int[] bandOffsets = dst.getBandOffsets();
       short[][] data = dst.getShortDataArrays();

       float[] warpData = new float[2 * dstWidth];

       int lineOffset = 0;

short[] backgroundUShort = new short[dstBands];
for (int i = 0; i < dstBands; i++)
    backgroundUShort[i] = (short)backgroundValues[i];

       for (int h = 0; h < dstHeight; h++) {
           int pixelOffset = lineOffset;
           lineOffset += lineStride;

           warp.warpRect(dst.getX(), dst.getY()+h, dstWidth, 1,
                         warpData);
           int count = 0;
           for (int w = 0; w < dstWidth; w++) {
               /*
                * The warp object subtract 0.5 from backward mapped
                * source coordinate. Need to do a round to get the
                * nearest neighbor. This is different from the standard
                * nearest implementation.
                */
               int sx = round(warpData[count++]);
               int sy = round(warpData[count++]);

               if (sx < minX || sx >= maxX || sy < minY || sy >= maxY) {
                   /* Fill with a background color. */
                   if (setBackground) {
                       for (int b = 0; b < dstBands; b++) {
                           data[b][pixelOffset+bandOffsets[b]] =
                               backgroundUShort[b];
                       }
                   }
               } else {
                   for (int b = 0; b < dstBands; b++) {
                       data[b][pixelOffset+bandOffsets[b]] =
                           (short)(iter.getSample(sx, sy, b) & 0xFFFF);
                   }
               }

               pixelOffset += pixelStride;
           }
       }
   }
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:62,代码来源:WarpNearestOpImage.java

示例4: computeRectShort

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
private void computeRectShort(PlanarImage src, RasterAccessor dst) {
       RandomIter iter = RandomIterFactory.create(src, src.getBounds());

       int minX = src.getMinX();
       int maxX = src.getMaxX();
       int minY = src.getMinY();
       int maxY = src.getMaxY();

       int dstWidth = dst.getWidth();
       int dstHeight = dst.getHeight();
       int dstBands = dst.getNumBands();

       int lineStride = dst.getScanlineStride();
       int pixelStride = dst.getPixelStride();
       int[] bandOffsets = dst.getBandOffsets();
       short[][] data = dst.getShortDataArrays();

       float[] warpData = new float[2 * dstWidth];

       int lineOffset = 0;

       short[] backgroundShort = new short[dstBands];
for (int i = 0; i < dstBands; i++)
    backgroundShort[i] = (short)backgroundValues[i];

       for (int h = 0; h < dstHeight; h++) {
           int pixelOffset = lineOffset;
           lineOffset += lineStride;

           warp.warpRect(dst.getX(), dst.getY()+h, dstWidth, 1,
                         warpData);
           int count = 0;
           for (int w = 0; w < dstWidth; w++) {
               /*
                * The warp object subtract 0.5 from backward mapped
                * source coordinate. Need to do a round to get the
                * nearest neighbor. This is different from the standard
                * nearest implementation.
                */
               int sx = round(warpData[count++]);
               int sy = round(warpData[count++]);

               if (sx < minX || sx >= maxX || sy < minY || sy >= maxY) {
                   /* Fill with a background color. */
                   if (setBackground) {
                       for (int b = 0; b < dstBands; b++) {
                           data[b][pixelOffset+bandOffsets[b]] =
                               backgroundShort[b];
                       }
                   }
               } else {
                   for (int b = 0; b < dstBands; b++) {
                       data[b][pixelOffset+bandOffsets[b]] =
                           (short)iter.getSample(sx, sy, b);
                   }
               }

               pixelOffset += pixelStride;
           }
       }
   }
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:62,代码来源:WarpNearestOpImage.java

示例5: computeRectInt

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
private void computeRectInt(PlanarImage src, RasterAccessor dst) {
       RandomIter iter = RandomIterFactory.create(src, src.getBounds());

       int minX = src.getMinX();
       int maxX = src.getMaxX();
       int minY = src.getMinY();
       int maxY = src.getMaxY();

       int dstWidth = dst.getWidth();
       int dstHeight = dst.getHeight();
       int dstBands = dst.getNumBands();

       int lineStride = dst.getScanlineStride();
       int pixelStride = dst.getPixelStride();
       int[] bandOffsets = dst.getBandOffsets();
       int[][] data = dst.getIntDataArrays();

       float[] warpData = new float[2 * dstWidth];

       int lineOffset = 0;

int[] backgroundInt = new int[dstBands];
for (int i = 0; i < dstBands; i++)
    backgroundInt[i] = (int)backgroundValues[i];

       for (int h = 0; h < dstHeight; h++) {
           int pixelOffset = lineOffset;
           lineOffset += lineStride;

           warp.warpRect(dst.getX(), dst.getY()+h, dstWidth, 1,
                         warpData);
           int count = 0;
           for (int w = 0; w < dstWidth; w++) {
               /*
                * The warp object subtract 0.5 from backward mapped
                * source coordinate. Need to do a round to get the
                * nearest neighbor. This is different from the standard
                * nearest implementation.
                */
               int sx = round(warpData[count++]);
               int sy = round(warpData[count++]);

               if (sx < minX || sx >= maxX || sy < minY || sy >= maxY) {
                   /* Fill with a background color. */
                   if (setBackground) {
                       for (int b = 0; b < dstBands; b++) {
                           data[b][pixelOffset+bandOffsets[b]] =
                               backgroundInt[b];
                       }
                   }
               } else {
                   for (int b = 0; b < dstBands; b++) {
                       data[b][pixelOffset+bandOffsets[b]] =
                           iter.getSample(sx, sy, b);
                   }
               }

               pixelOffset += pixelStride;
           }
       }
   }
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:62,代码来源:WarpNearestOpImage.java

示例6: computeRectFloat

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
private void computeRectFloat(PlanarImage src, RasterAccessor dst) {
       RandomIter iter = RandomIterFactory.create(src, src.getBounds());

       int minX = src.getMinX();
       int maxX = src.getMaxX();
       int minY = src.getMinY();
       int maxY = src.getMaxY();

       int dstWidth = dst.getWidth();
       int dstHeight = dst.getHeight();
       int dstBands = dst.getNumBands();

       int lineStride = dst.getScanlineStride();
       int pixelStride = dst.getPixelStride();
       int[] bandOffsets = dst.getBandOffsets();
       float[][] data = dst.getFloatDataArrays();

       float[] warpData = new float[2 * dstWidth];

       int lineOffset = 0;

float[] backgroundFloat = new float[dstBands];
for (int i = 0; i < dstBands; i++)
    backgroundFloat[i] = (float)backgroundValues[i];

       for (int h = 0; h < dstHeight; h++) {
           int pixelOffset = lineOffset;
           lineOffset += lineStride;

           warp.warpRect(dst.getX(), dst.getY()+h, dstWidth, 1,
                         warpData);
           int count = 0;
           for (int w = 0; w < dstWidth; w++) {
               /*
                * The warp object subtract 0.5 from backward mapped
                * source coordinate. Need to do a round to get the
                * nearest neighbor. This is different from the standard
                * nearest implementation.
                */
               int sx = round(warpData[count++]);
               int sy = round(warpData[count++]);

               if (sx < minX || sx >= maxX || sy < minY || sy >= maxY) {
                   /* Fill with a background color. */
                   if (setBackground) {
                       for (int b = 0; b < dstBands; b++) {
                           data[b][pixelOffset+bandOffsets[b]] =
                               backgroundFloat[b];
                       }
                   }
               } else {
                   for (int b = 0; b < dstBands; b++) {
                       data[b][pixelOffset+bandOffsets[b]] =
                           iter.getSampleFloat(sx, sy, b);
                   }
               }

               pixelOffset += pixelStride;
           }
       }
   }
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:62,代码来源:WarpNearestOpImage.java

示例7: computeRectDouble

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
private void computeRectDouble(PlanarImage src, RasterAccessor dst) {
    RandomIter iter = RandomIterFactory.create(src, src.getBounds());

    int minX = src.getMinX();
    int maxX = src.getMaxX();
    int minY = src.getMinY();
    int maxY = src.getMaxY();

    int dstWidth = dst.getWidth();
    int dstHeight = dst.getHeight();
    int dstBands = dst.getNumBands();

    int lineStride = dst.getScanlineStride();
    int pixelStride = dst.getPixelStride();
    int[] bandOffsets = dst.getBandOffsets();
    double[][] data = dst.getDoubleDataArrays();

    float[] warpData = new float[2 * dstWidth];

    int lineOffset = 0;

    for (int h = 0; h < dstHeight; h++) {
        int pixelOffset = lineOffset;
        lineOffset += lineStride;

        warp.warpRect(dst.getX(), dst.getY()+h, dstWidth, 1,
                      warpData);
        int count = 0;
        for (int w = 0; w < dstWidth; w++) {
            /*
             * The warp object subtract 0.5 from backward mapped
             * source coordinate. Need to do a round to get the
             * nearest neighbor. This is different from the standard
             * nearest implementation.
             */
            int sx = round(warpData[count++]);
            int sy = round(warpData[count++]);

            if (sx < minX || sx >= maxX || sy < minY || sy >= maxY) {
                /* Fill with a background color. */
                if (setBackground) {
                    for (int b = 0; b < dstBands; b++) {
                        data[b][pixelOffset+bandOffsets[b]] =
                            backgroundValues[b];
                    }
                }
            } else {
                for (int b = 0; b < dstBands; b++) {
                    data[b][pixelOffset+bandOffsets[b]] =
                        iter.getSampleDouble(sx, sy, b);
                }
            }

            pixelOffset += pixelStride;
        }
    }
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:58,代码来源:WarpNearestOpImage.java

示例8: computeRectUShort

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
private void computeRectUShort(PlanarImage src, RasterAccessor dst) {
       RandomIter iter;
       if(extender != null) {
           Rectangle bounds = new Rectangle(src.getMinX(), src.getMinY(),
                                            src.getWidth() + 1,
                                            src.getHeight() + 1);
           iter = RandomIterFactory.create(src.getExtendedData(bounds,
                                                               extender),
                                           bounds);
       } else {
           iter = RandomIterFactory.create(src, src.getBounds());
       }

       int minX = src.getMinX();
       int maxX = src.getMaxX() -
           (extender != null ? 0 : 1); // Right padding
       int minY = src.getMinY();
       int maxY = src.getMaxY() -
           (extender != null ? 0 : 1); // Bottom padding

       int dstWidth = dst.getWidth();
       int dstHeight = dst.getHeight();
       int dstBands = dst.getNumBands();

       int lineStride = dst.getScanlineStride();
       int pixelStride = dst.getPixelStride();
       int[] bandOffsets = dst.getBandOffsets();
       short[][] data = dst.getShortDataArrays();

       float[] warpData = new float[2 * dstWidth];

       int lineOffset = 0;

short[] backgroundUShort = new short[dstBands];
for (int i = 0; i < dstBands; i++)
    backgroundUShort[i] = (short)backgroundValues[i];

       for (int h = 0; h < dstHeight; h++) {
           int pixelOffset = lineOffset;
           lineOffset += lineStride;

           warp.warpRect(dst.getX(), dst.getY()+h, dstWidth, 1,
                         warpData);
           int count = 0;
           for (int w = 0; w < dstWidth; w++) {
               float sx = warpData[count++];
               float sy = warpData[count++];

               int xint = floor(sx);
               int yint = floor(sy);
               float xfrac = sx - xint;
               float yfrac = sy - yint;

               if (xint < minX || xint >= maxX ||
                   yint < minY || yint >= maxY) {
                   /* Fill with a background color. */
                   if (setBackground) {
                       for (int b = 0; b < dstBands; b++) {
                           data[b][pixelOffset+bandOffsets[b]] =
                               backgroundUShort[b];
                       }
                   }
               } else {
                   for (int b = 0; b < dstBands; b++) {
                       int s00 = iter.getSample(xint, yint, b) & 0xFFFF;
                       int s01 = iter.getSample(xint+1, yint, b) & 0xFFFF;
                       int s10 = iter.getSample(xint, yint+1, b) & 0xFFFF;
                       int s11 = iter.getSample(xint+1, yint+1, b) & 0xFFFF;

                       float s0 = (s01 - s00) * xfrac + s00;
                       float s1 = (s11 - s10) * xfrac + s10;
                       float s = (s1 - s0) * yfrac + s0;

                       data[b][pixelOffset+bandOffsets[b]] = (short)s;
                   }
               }

               pixelOffset += pixelStride;
           }
       }
   }
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:82,代码来源:WarpBilinearOpImage.java

示例9: computeRectShort

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
private void computeRectShort(PlanarImage src, RasterAccessor dst) {
       RandomIter iter;
       if(extender != null) {
           Rectangle bounds = new Rectangle(src.getMinX(), src.getMinY(),
                                            src.getWidth() + 1,
                                            src.getHeight() + 1);
           iter = RandomIterFactory.create(src.getExtendedData(bounds,
                                                               extender),
                                           bounds);
       } else {
           iter = RandomIterFactory.create(src, src.getBounds());
       }

       int minX = src.getMinX();
       int maxX = src.getMaxX() -
           (extender != null ? 0 : 1); // Right padding
       int minY = src.getMinY();
       int maxY = src.getMaxY() -
           (extender != null ? 0 : 1); // Bottom padding

       int dstWidth = dst.getWidth();
       int dstHeight = dst.getHeight();
       int dstBands = dst.getNumBands();

       int lineStride = dst.getScanlineStride();
       int pixelStride = dst.getPixelStride();
       int[] bandOffsets = dst.getBandOffsets();
       short[][] data = dst.getShortDataArrays();

       float[] warpData = new float[2 * dstWidth];

       int lineOffset = 0;

       short[] backgroundShort = new short[dstBands];
for (int i = 0; i < dstBands; i++)
    backgroundShort[i] = (short)backgroundValues[i];

       for (int h = 0; h < dstHeight; h++) {
           int pixelOffset = lineOffset;
           lineOffset += lineStride;

           warp.warpRect(dst.getX(), dst.getY()+h, dstWidth, 1,
                         warpData);
           int count = 0;
           for (int w = 0; w < dstWidth; w++) {
               float sx = warpData[count++];
               float sy = warpData[count++];

               int xint = floor(sx);
               int yint = floor(sy);
               float xfrac = sx - xint;
               float yfrac = sy - yint;

               if (xint < minX || xint >= maxX ||
                   yint < minY || yint >= maxY) {
                   /* Fill with a background color. */
                   if (setBackground) {
                       for (int b = 0; b < dstBands; b++) {
                           data[b][pixelOffset+bandOffsets[b]] =
                               backgroundShort[b];
                       }
                   }
               } else {
                   for (int b = 0; b < dstBands; b++) {
                       int s00 = iter.getSample(xint, yint, b);
                       int s01 = iter.getSample(xint+1, yint, b);
                       int s10 = iter.getSample(xint, yint+1, b);
                       int s11 = iter.getSample(xint+1, yint+1, b);

                       float s0 = (s01 - s00) * xfrac + s00;
                       float s1 = (s11 - s10) * xfrac + s10;
                       float s = (s1 - s0) * yfrac + s0;

                       data[b][pixelOffset+bandOffsets[b]] = (short)s;
                   }
               }

               pixelOffset += pixelStride;
           }
       }
   }
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:82,代码来源:WarpBilinearOpImage.java

示例10: computeRectInt

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
private void computeRectInt(PlanarImage src, RasterAccessor dst) {
       RandomIter iter;
       if(extender != null) {
           Rectangle bounds = new Rectangle(src.getMinX(), src.getMinY(),
                                            src.getWidth() + 1,
                                            src.getHeight() + 1);
           iter = RandomIterFactory.create(src.getExtendedData(bounds,
                                                               extender),
                                           bounds);
       } else {
           iter = RandomIterFactory.create(src, src.getBounds());
       }

       int minX = src.getMinX();
       int maxX = src.getMaxX() -
           (extender != null ? 0 : 1); // Right padding
       int minY = src.getMinY();
       int maxY = src.getMaxY() -
           (extender != null ? 0 : 1); // Bottom padding

       int dstWidth = dst.getWidth();
       int dstHeight = dst.getHeight();
       int dstBands = dst.getNumBands();

       int lineStride = dst.getScanlineStride();
       int pixelStride = dst.getPixelStride();
       int[] bandOffsets = dst.getBandOffsets();
       int[][] data = dst.getIntDataArrays();

       float[] warpData = new float[2 * dstWidth];

       int lineOffset = 0;

int[] backgroundInt = new int[dstBands];
for (int i = 0; i < dstBands; i++)
    backgroundInt[i] = (int)backgroundValues[i];

       for (int h = 0; h < dstHeight; h++) {
           int pixelOffset = lineOffset;
           lineOffset += lineStride;

           warp.warpRect(dst.getX(), dst.getY()+h, dstWidth, 1,
                         warpData);
           int count = 0;
           for (int w = 0; w < dstWidth; w++) {
               float sx = warpData[count++];
               float sy = warpData[count++];

               int xint = floor(sx);
               int yint = floor(sy);
               float xfrac = sx - xint;
               float yfrac = sy - yint;

               if (xint < minX || xint >= maxX ||
                   yint < minY || yint >= maxY) {
                   /* Fill with a background color. */
                   if (setBackground) {
                       for (int b = 0; b < dstBands; b++) {
                           data[b][pixelOffset+bandOffsets[b]] =
                               backgroundInt[b];
                       }
                   }
               } else {
                   for (int b = 0; b < dstBands; b++) {
                       int s00 = iter.getSample(xint, yint, b);
                       int s01 = iter.getSample(xint+1, yint, b);
                       int s10 = iter.getSample(xint, yint+1, b);
                       int s11 = iter.getSample(xint+1, yint+1, b);

                       float s0 = (s01 - s00) * xfrac + s00;
                       float s1 = (s11 - s10) * xfrac + s10;
                       float s = (s1 - s0) * yfrac + s0;

                       data[b][pixelOffset+bandOffsets[b]] = (int)s;
                   }
               }

               pixelOffset += pixelStride;
           }
       }
   }
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:82,代码来源:WarpBilinearOpImage.java

示例11: computeRectFloat

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
private void computeRectFloat(PlanarImage src, RasterAccessor dst) {
       RandomIter iter;
       if(extender != null) {
           Rectangle bounds = new Rectangle(src.getMinX(), src.getMinY(),
                                            src.getWidth() + 1,
                                            src.getHeight() + 1);
           iter = RandomIterFactory.create(src.getExtendedData(bounds,
                                                               extender),
                                           bounds);
       } else {
           iter = RandomIterFactory.create(src, src.getBounds());
       }

       int minX = src.getMinX();
       int maxX = src.getMaxX() -
           (extender != null ? 0 : 1); // Right padding
       int minY = src.getMinY();
       int maxY = src.getMaxY() -
           (extender != null ? 0 : 1); // Bottom padding

       int dstWidth = dst.getWidth();
       int dstHeight = dst.getHeight();
       int dstBands = dst.getNumBands();

       int lineStride = dst.getScanlineStride();
       int pixelStride = dst.getPixelStride();
       int[] bandOffsets = dst.getBandOffsets();
       float[][] data = dst.getFloatDataArrays();

       float[] warpData = new float[2 * dstWidth];

       int lineOffset = 0;

float[] backgroundFloat = new float[dstBands];
for (int i = 0; i < dstBands; i++)
    backgroundFloat[i] = (float)backgroundValues[i];

       for (int h = 0; h < dstHeight; h++) {
           int pixelOffset = lineOffset;
           lineOffset += lineStride;

           warp.warpRect(dst.getX(), dst.getY()+h, dstWidth, 1,
                         warpData);
           int count = 0;
           for (int w = 0; w < dstWidth; w++) {
               float sx = warpData[count++];
               float sy = warpData[count++];

               int xint = floor(sx);
               int yint = floor(sy);
               float xfrac = sx - xint;
               float yfrac = sy - yint;

               if (xint < minX || xint >= maxX ||
                   yint < minY || yint >= maxY) {
                   /* Fill with a background color. */
                   if (setBackground) {
                       for (int b = 0; b < dstBands; b++) {
                           data[b][pixelOffset+bandOffsets[b]] =
                               backgroundFloat[b];
                       }
                   }
               } else {
                   for (int b = 0; b < dstBands; b++) {
                       float s00 = iter.getSampleFloat(xint, yint, b);
                       float s01 = iter.getSampleFloat(xint+1, yint, b);
                       float s10 = iter.getSampleFloat(xint, yint+1, b);
                       float s11 = iter.getSampleFloat(xint+1, yint+1, b);

                       float s0 = (s01 - s00) * xfrac + s00;
                       float s1 = (s11 - s10) * xfrac + s10;
                       float s = (s1 - s0) * yfrac + s0;

                       data[b][pixelOffset+bandOffsets[b]] = s;
                   }
               }

               pixelOffset += pixelStride;
           }
       }
   }
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:82,代码来源:WarpBilinearOpImage.java

示例12: computeRectDouble

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
private void computeRectDouble(PlanarImage src, RasterAccessor dst) {
    RandomIter iter;
    if(extender != null) {
        Rectangle bounds = new Rectangle(src.getMinX(), src.getMinY(),
                                         src.getWidth() + 1,
                                         src.getHeight() + 1);
        iter = RandomIterFactory.create(src.getExtendedData(bounds,
                                                            extender),
                                        bounds);
    } else {
        iter = RandomIterFactory.create(src, src.getBounds());
    }

    int minX = src.getMinX();
    int maxX = src.getMaxX() -
        (extender != null ? 0 : 1); // Right padding
    int minY = src.getMinY();
    int maxY = src.getMaxY() -
        (extender != null ? 0 : 1); // Bottom padding

    int dstWidth = dst.getWidth();
    int dstHeight = dst.getHeight();
    int dstBands = dst.getNumBands();

    int lineStride = dst.getScanlineStride();
    int pixelStride = dst.getPixelStride();
    int[] bandOffsets = dst.getBandOffsets();
    double[][] data = dst.getDoubleDataArrays();

    float[] warpData = new float[2 * dstWidth];

    int lineOffset = 0;

    for (int h = 0; h < dstHeight; h++) {
        int pixelOffset = lineOffset;
        lineOffset += lineStride;

        warp.warpRect(dst.getX(), dst.getY()+h, dstWidth, 1,
                      warpData);
        int count = 0;
        for (int w = 0; w < dstWidth; w++) {
            float sx = warpData[count++];
            float sy = warpData[count++];

            int xint = floor(sx);
            int yint = floor(sy);
            float xfrac = sx - xint;
            float yfrac = sy - yint;

            if (xint < minX || xint >= maxX ||
                yint < minY || yint >= maxY) {
                /* Fill with a background color. */
                if (setBackground) {
                    for (int b = 0; b < dstBands; b++) {
                        data[b][pixelOffset+bandOffsets[b]] =
                            backgroundValues[b];
                    }
                }
            } else {
                for (int b = 0; b < dstBands; b++) {
                    double s00 = iter.getSampleDouble(xint, yint, b);
                    double s01 = iter.getSampleDouble(xint+1, yint, b);
                    double s10 = iter.getSampleDouble(xint, yint+1, b);
                    double s11 = iter.getSampleDouble(xint+1, yint+1, b);

                    double s0 = (s01 - s00) * xfrac + s00;
                    double s1 = (s11 - s10) * xfrac + s10;
                    double s = (s1 - s0) * yfrac + s0;

                    data[b][pixelOffset+bandOffsets[b]] = s;
                }
            }

            pixelOffset += pixelStride;
        }
    }
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:78,代码来源:WarpBilinearOpImage.java

示例13: getProperty

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
/**
 * Returns the specified property.
 *
 * @param name Property name.
 * @param op   Operation node.
 */
public Object getProperty(String name,
                          RenderedOp op) {
    if(name == null || op == null) {
        throw new IllegalArgumentException
            (JaiI18N.getString("SubsampleAveragePropertyGenerator4"));
    }

    if (name.equals("roi")) {
        ParameterBlock pb = op.getParameterBlock();

        // Retrieve the rendered source image and its ROI.
        PlanarImage src = (PlanarImage)pb.getRenderedSource(0);
        Object property = src.getProperty("ROI");
        if (property == null ||
            property.equals(java.awt.Image.UndefinedProperty) ||
            !(property instanceof ROI)) {
            return null;
        }
        ROI srcROI = (ROI)property;

        // Determine the effective source bounds.
        Rectangle srcBounds = null;
        PlanarImage dst = op.getRendering();
        if(dst instanceof GeometricOpImage &&
           ((GeometricOpImage)dst).getBorderExtender() == null) {
            GeometricOpImage geomIm = (GeometricOpImage)dst;
            Interpolation interp = geomIm.getInterpolation();
            srcBounds =
                new Rectangle(src.getMinX() + interp.getLeftPadding(),
                              src.getMinY() + interp.getTopPadding(),
                              src.getWidth() - interp.getWidth() + 1,
                              src.getHeight() - interp.getHeight() + 1);
        } else {
            srcBounds = src.getBounds();
        }

        // If necessary, clip the ROI to the effective source bounds.
        if(!srcBounds.contains(srcROI.getBounds())) {
            srcROI = srcROI.intersect(new ROIShape(srcBounds));
        }

        // Retrieve the scale factors and translation values.
        double sx = pb.getDoubleParameter(0);
        double sy = pb.getDoubleParameter(1);

        // Create an equivalent transform.
        AffineTransform transform =
            new AffineTransform(sx, 0.0, 0.0, sy, 0, 0);

        // Create the scaled ROI.
        ROI dstROI = srcROI.transform(transform);

        // Retrieve the destination bounds.
        Rectangle dstBounds = op.getBounds();

        // If necessary, clip the warped ROI to the destination bounds.
        if(!dstBounds.contains(dstROI.getBounds())) {
            dstROI = dstROI.intersect(new ROIShape(dstBounds));
        }

        // Return the warped and possibly clipped ROI.
        return dstROI;
    } else {
        return null;
    }
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:73,代码来源:SubsampleAverageDescriptor.java

示例14: getRenderingHints

import javax.media.jai.PlanarImage; //导入方法依赖的package包/类
/**
 * Defines RenderingHints for JAI create operations (otherwise JAI will use defaultTileSize tiling)
 *
 * @param image
 * @return
 */
public static RenderingHints getRenderingHints(PlanarImage image) {
    ImageLayout layout = new ImageLayout(image.getMinX(), image.getMinY(), image.getWidth(), image.getHeight(), image.getTileGridXOffset(), image.getTileGridYOffset(), image.getTileWidth(), image.getTileHeight(), image.getSampleModel(), image.getColorModel());
    RenderingHints renderingHints = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, layout);
    return renderingHints;
}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:12,代码来源:ManipulationUtils.java


注:本文中的javax.media.jai.PlanarImage.getMinX方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。