Class ImageLineIntegral
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptiondouble
compute
(double x0, double y0, double x1, double y1) Computes the line segment's line integral across the inside of the image.double
Returns the line segment's lengthboolean
isInside
(double x, double y) Return true if the coordinate is inside the image or false if not.
0 ≤ x ≤ width
0 ≤ y ≤ heightvoid
setImage
(GImageGray image) Specify input image.
-
Constructor Details
-
ImageLineIntegral
public ImageLineIntegral()
-
-
Method Details
-
setImage
Specify input image.- Parameters:
image
- image
-
compute
public double compute(double x0, double y0, double x1, double y1) Computes the line segment's line integral across the inside of the image. Where the inside is defined as 0 ≤ x ≤ width and 0 ≤ y ≤ height.- Parameters:
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-coordinate- Returns:
- line integral
-
isInside
public boolean isInside(double x, double y) Return true if the coordinate is inside the image or false if not.
0 ≤ x ≤ width
0 ≤ y ≤ heightNote: 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.
- Parameters:
x
- x-coordinate in pixel coordinatesy
- y-coordinate in pixel coordinates- Returns:
- true if inside or false if outside
-
getLength
public double getLength()Returns the line segment's length- Returns:
- length
-