Package ch.epfl.cs107.play.math
Class RegionOfInterest
java.lang.Object
ch.epfl.cs107.play.math.RegionOfInterest
- All Implemented Interfaces:
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
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 systemy- (int) top left pixel y coordinate in the image coordinate systemw- (int) width in number of pixelh- (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
Region of interest builder using top left and bottom right corner position- Parameters:
x1- (int): top left x-coordinatey1- (int): top left y-coordinatex2- (int): bottom-right x-coordinatey2- (int): bottom-right y-coordinate- Returns:
- (RegionOfInterest): build a RegionOfInterest using the bottom right corner instead of the dimensions
-
hashCode
public int hashCode() -
equals
-
toString
-