|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcore.image.ScalarImage
Stores a monochrome image of floats = < width, height, float-buffer >. A ScalarImage stores a rectangular array of scalar values. The image"s width and height are specified upon construction, and a float-buffer is created of size width*height, storing the data in left-right, top-down scanline order. Though the scalar data is stored internally as floats to save space, they are accessed as doubles for compatibility. The ScalarImage can also be viewed as a continuous field over a rectangle, with the value at integer coordinates equal to the scalar values, and the values at fractional coordinates interpolated between them. Since the values are interpolated, the effective size of the field becomes (width-1) by (height-1).
Field Summary | |
float[] |
f
f[] stores all the scalar values in scanline order |
int |
height
width, height store the dimensions of the image. |
int[] |
offset
offset[] indexes the left-most pixel of each scanline in f[] The index of pixel (x,y) is therefore offset[y]+x |
int |
size
width, height store the dimensions of the image. |
int |
width
width, height store the dimensions of the image. |
Constructor Summary | |
ScalarImage(int width,
int height)
Constructs a new ScalarImage = < width, height, zero-buffer > |
Method Summary | |
void |
Accumulate(int x,
int y,
double s)
Adds "s" to the scalar value at (x, y). |
void |
AccumulateBilinear(double x,
double y,
double s)
Bilinearly accumulates "s" to the four integer grid points surrounding the continuous coordinate (x, y). |
void |
AccumulateBilinear(Vec2 v,
double s)
Bilinearly accumulates "s" to the four integer grid points surrounding the continuous coordinate "v". |
void |
Add(ScalarImage image)
|
void |
Clamp(double min,
double max)
|
void |
Clear()
Clears all the scalar values to zero. |
void |
Convolve3x3(double[] kernel)
Performs a convolution on "this" with a 3x3 kernel and scalar offset. |
void |
Copy(ScalarImage image)
Copies the scalar values from the top-left corner of "image" to "this" Requires: "image" is at least as large as "this" |
void |
Copy(ScalarImage image,
int xorigin,
int yorigin)
Copies the scalar values from the sub-window of "image" starting at (xorigin, yorigin) to "this". |
double |
get(int x,
int y)
Returns: the scalar value at (x, y) Requires: 0<=x |
double |
getBilinear(double x,
double y)
Returns: the bilinearly-interpolated value of the continuous field at (x, y). |
double |
getBilinear(Vec2 v)
Returns: the bilinearly-interpolated value of the continuous field at "v". |
boolean |
hasSingularity()
Returns: true if any scalar value in "this" is invalid |
boolean |
inBounds(double x,
double y)
Returns: true if 0.0<=x<=(width-1.0) and 0.0<=y<=(height-1.0), false otherwise, the domain check for when "this" is viewed as a continuous field. |
boolean |
inBounds(int x,
int y)
Returns: true if 0<=x |
boolean |
inBounds(Vec2 v)
Returns: true if "v" is within the domain of "this" when viewed as a continuous field. |
void |
Modulate(ScalarImage image)
|
void |
Power(double exp)
Transforms all the scalar values in "this" by the rule: f" = f^exp |
void |
Rescale(double scale,
double add)
Rescales all the scalar values in "this" by the rule: f" = f*scale + add |
void |
Set(int x,
int y,
double s)
Sets the scalar value at (x, y) to "s". |
void |
SetRandom()
Sets all the scalars in "this" to random values uniformly distributed over (0.0, 1.0). |
void |
SetRandom(java.util.Random random)
Sets all the scalars in "this" to random values uniformly distributed over (0.0, 1.0) using the pseudo-random generator "random". |
void |
SetZero()
Sets all the scalar values to zero |
void |
StretchBilinear(ScalarImage image)
Rescales the scalar data in "image" to "this" using bilinear interpolation. |
void |
Vec2FieldMagnitude(Vec2Field field,
Vec2Transform ftoi)
|
void |
Vec2FieldZero(Vec2Field field,
Vec2Transform ftoi)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public final int width
public final int height
public final int size
public float[] f
public final int[] offset
Constructor Detail |
public ScalarImage(int width, int height)
Method Detail |
public void SetZero()
public void Clear()
public void Copy(ScalarImage image, int xorigin, int yorigin)
public void Copy(ScalarImage image)
public void StretchBilinear(ScalarImage image)
public boolean inBounds(int x, int y)
public boolean inBounds(double x, double y)
public boolean inBounds(Vec2 v)
public double get(int x, int y)
public void Set(int x, int y, double s)
public void Accumulate(int x, int y, double s)
public double getBilinear(double x, double y)
public double getBilinear(Vec2 v)
public void AccumulateBilinear(double x, double y, double s)
public void AccumulateBilinear(Vec2 v, double s)
public void Rescale(double scale, double add)
public void Power(double exp)
public void Convolve3x3(double[] kernel)
public boolean hasSingularity()
public void SetRandom(java.util.Random random)
public void SetRandom()
public void Vec2FieldMagnitude(Vec2Field field, Vec2Transform ftoi)
public void Vec2FieldZero(Vec2Field field, Vec2Transform ftoi)
public void Modulate(ScalarImage image)
public void Add(ScalarImage image)
public void Clamp(double min, double max)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |