Class ImageLineIntegral

java.lang.Object
boofcv.alg.interpolate.ImageLineIntegral

public class ImageLineIntegral extends 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 Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    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
    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
    Specify input image.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ImageLineIntegral

      public ImageLineIntegral()
  • Method Details

    • setImage

      public void setImage(GImageGray image)
      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-coordinate
      y0 - end point of line segment. y-coordinate
      x1 - end point of line segment. x-coordinate
      y1 - 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 ≤ 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.

      Parameters:
      x - x-coordinate in pixel coordinates
      y - 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