Exemplo n.º 1
0
 public void stretchBilinear(ScalarImage image)
       /* Rescales the scalar data in 'image' to 'this' using bilinear interpolation. */
     {
   double xscale = (image.width - 1.0) / (width - 1.0);
   double yscale = (image.height - 1.0) / (height - 1.0);
   for (int j = height - 1, k = size - 1; j >= 0; --j)
     for (int i = width - 1; i >= 0; --i, --k)
       f[k] = (float) image.getBilinear(i * xscale, j * yscale);
 }
Exemplo n.º 2
0
  /**
   * Copy constructor, may be used to convert AccumImage.
   *
   * @param image
   */
  public ScalarImage(ScalarImage image) {
    this.width = image.width;
    this.height = image.height;
    this.size = this.width * this.height;

    f = new float[size];
    offset = new int[height];
    for (int j = 0; j < height; ++j) offset[j] = width * j;

    for (int k = 0; k < size; ++k) f[k] = image.getF(k);
    ;
  }
Exemplo n.º 3
0
  public void copy(ScalarImage image, int xorigin, int yorigin)
        /* Copies the scalar values from the sub-window of 'image' starting at
         *   (xorigin, yorigin) to 'this'.
         * Requires: the sub-window fits inside 'image' */
      {
    if (((xorigin + width) > image.width) || ((yorigin + height) > image.height))
      throw new RuntimeException("ScalarImage.Copy: Window too large");

    for (int j = 0, k = 0; j < height; ++j)
      for (int i = 0, l = image.offset[j + yorigin] + xorigin; i < width; ++i, ++k, ++l)
        f[k] = image.getF(l);
  }