public class ImageLineIntegral
extends java.lang.Object
Computes the line integral of a line segment across the image. A line is laid over the image and the fraction of the line which is over a pixel is multiplied by the pixel's value. This is done for each pixel it overlaps.
Two different functions are provided below for handling pixels lines which are either contained entirely
inside the image or may contain elements which extend outside the image. If a pixel extends outside the
image then ImageBorder is used to handle the pixels outside the image. If the border is not
specified then it will likely crash.
Inside image definition:
0 &le x < width
0 &le y < height
| Constructor and Description |
|---|
ImageLineIntegral() |
| Modifier and Type | Method and Description |
|---|---|
double |
compute(double x0,
double y0,
double x1,
double y1)
Computes the line segment's line integral across the inside of the image.
|
double |
getLength()
Returns the line segment's length
|
boolean |
isInside(double x,
double y)
Return true if the coordinate is inside the image or false if not.
0 ≤ x ≤ width 0 ≤ y ≤ height |
void |
setImage(GImageGray image)
Specify input image.
|
public void setImage(GImageGray image)
image - imagepublic double compute(double x0,
double y0,
double x1,
double y1)
x0 - end point of line segment. x-coordinatey0 - end point of line segment. y-coordinatex1 - end point of line segment. x-coordinatey1 - end point of line segment. y-coordinatepublic boolean isInside(double x,
double y)
Return true if the coordinate is inside the image or false if not.
0 ≤ x ≤ width
0 ≤ y ≤ height
Note: while the image is defined up to width and height, including coordinates up to that point contribute nothing towards the line integral since they are infinitesimally small.
x - x-coordinate in pixel coordinatesy - y-coordinate in pixel coordinatespublic double getLength()