Class RegionOfInterest

java.lang.Object
ch.epfl.cs107.play.math.RegionOfInterest
All Implemented Interfaces:
Serializable

public final class RegionOfInterest extends Object implements Serializable
Represents an immutable RegionOfInterest (RoI) in Image. A RegionOfInterest is a rectangle defined by its top left corner and either dimension (width and height) or bottom right corner
See Also:
  • Field Details

    • x

      public int x
    • y

      public int y
    • w

      public int w
    • h

      public int h
  • Constructor Details

    • RegionOfInterest

      public RegionOfInterest(int x, int y, int w, int h)
      Create A new RegionOfInterest
      Parameters:
      x - (int) top left pixel x coordinate in the image coordinate system
      y - (int) top left pixel y coordinate in the image coordinate system
      w - (int) width in number of pixel
      h - (int) height in number of pixel
  • Method Details

    • x1

      public int x1()
      Returns:
      (int): top left pixel x coordinate
    • x2

      public int x2()
      Returns:
      (int): bottom right pixel x coordinate
    • y1

      public int y1()
      Returns:
      (int): top left pixel y coordinate
    • y2

      public int y2()
      Returns:
      (int): bottom right y coordinate
    • pixelsNumber

      public int pixelsNumber()
      Returns:
      (int): the number of pixel contained inside the RoI
    • buildAltRegion

      public RegionOfInterest buildAltRegion(int x1, int y1, int x2, int y2)
      Region of interest builder using top left and bottom right corner position
      Parameters:
      x1 - (int): top left x-coordinate
      y1 - (int): top left y-coordinate
      x2 - (int): bottom-right x-coordinate
      y2 - (int): bottom-right y-coordinate
      Returns:
      (RegionOfInterest): build a RegionOfInterest using the bottom right corner instead of the dimensions
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object