Beispiel #1
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);
    ;
  }
Beispiel #2
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);
  }