public class RectangleSampler extends Object implements Iterable<Rectangle>
RectangleSampler
provides an easy way to generate a sliding window
of rectangle over an image or other domain.Constructor and Description |
---|
RectangleSampler(float minx,
float maxx,
float miny,
float maxy,
float stepx,
float stepy,
float width,
float height)
Construct the sampler with the given parameters
|
RectangleSampler(Image<?,?> img,
float stepx,
float stepy,
float width,
float height)
Construct the sampler with the given parameters
|
RectangleSampler(Rectangle bounds,
float stepx,
float stepy,
float width,
float height)
Construct the sampler with the given parameters
|
Modifier and Type | Method and Description |
---|---|
List<Rectangle> |
allRectangles()
Get a list of all the rectangles that can be produced by this sampler
|
Iterator<Rectangle> |
iterator() |
void |
setBounds(float minx,
float maxx,
float miny,
float maxy)
Adjust the bounds of the sampler
|
void |
setBounds(Image<?,?> img)
Adjust the bounds of the sampler
|
void |
setBounds(Rectangle r)
Adjust the bounds of the sampler
|
<I extends Image<?,I>> |
subImageIterator(I image)
Create an iterator to extract sub-images from an image based on the
rectangles defined by this sampler.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public RectangleSampler(float minx, float maxx, float miny, float maxy, float stepx, float stepy, float width, float height)
minx
- starting x-ordinatemaxx
- finishing x-ordinateminy
- starting y-ordinatemaxy
- finishing y-ordinatestepx
- step size in x directionstepy
- step size in y directionwidth
- width of sample windowheight
- height of sample windowpublic RectangleSampler(Rectangle bounds, float stepx, float stepy, float width, float height)
bounds
- the bounds in which the window must remain; it will start in
the top-left cornerstepx
- step size in x directionstepy
- step size in y directionwidth
- width of sample windowheight
- height of sample windowpublic RectangleSampler(Image<?,?> img, float stepx, float stepy, float width, float height)
img
- the image from which to set the sampler bounds (will be set to
the complete image)stepx
- step size in x directionstepy
- step size in y directionwidth
- width of sample windowheight
- height of sample windowpublic void setBounds(float minx, float maxx, float miny, float maxy)
minx
- starting x-ordinatemaxx
- finishing x-ordinateminy
- starting y-ordinatemaxy
- finishing y-ordinatepublic void setBounds(Rectangle r)
r
- the new bounds rectanglepublic void setBounds(Image<?,?> img)
img
- the image to determine the bounds frompublic List<Rectangle> allRectangles()
public <I extends Image<?,I>> Iterator<I> subImageIterator(I image)
image
- the image to extract from