|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectFacemorph.mask.VectorMask
public class VectorMask
Defines a mask file (a list of which contours to follow in a Template and in which directions).
Field Summary | |
---|---|
static int |
CONTOUR_FORWARD
Indicates a line goes in the direction of points |
static int |
CONTOUR_REVERSE
Indicates a line goes in the opposite direction to the points |
static java.awt.Color |
maskColour
|
static int |
POINT
indicates a point, not a line |
Constructor Summary | |
---|---|
VectorMask()
Creates a new instance of MaskInterface |
Method Summary | |
---|---|
void |
add(int index,
int dir)
Adds a contour or point to this mask |
VectorMask |
clone()
Creates and returns a copy of this object. |
void |
delete(int index)
Delete a contour from this mask |
FloatImage |
getAsFloatImage(Template tem,
int w,
int h,
float min,
float max)
Constructs a FloatImage with values of 0 (masked) and max (not masked) |
static FloatImage |
getAsFloatImage(Template tem,
java.util.Vector<java.lang.Integer> maskDirections,
java.util.Vector<java.lang.Integer> maskConts,
int w,
int h,
float min,
float max)
|
double |
getBlur()
Gets the size of the Gaussian (or implementation specific) blur to apply to the mask |
java.util.Vector<java.lang.Integer> |
getContours()
Get the list of contours for this mask |
java.util.Vector<java.lang.Integer> |
getDirections()
Get the list of directions for this mask |
javax.swing.filechooser.FileNameExtensionFilter |
getExt()
|
java.awt.Polygon |
getMask(Template tem,
int xoff,
int yoff,
float zoom)
Constructs a masking polygon from this Template and MaskInterface |
FloatImage |
maskImage(FloatImage img,
Template tem,
java.awt.Color col,
boolean reverse)
Masks an image using the mask object specified/ |
java.awt.Image |
maskImage(java.awt.Image img,
Template tem,
java.awt.Color col,
boolean reverse)
Masks an image using the mask object specified/ |
void |
paint(Template tem,
java.awt.Graphics g,
java.awt.Color col,
int xoff,
int yoff,
int width,
int height,
float zoom)
Paint the mask using the supplied Graphics component |
void |
paint(Template tem,
java.awt.Graphics g,
java.awt.Color col,
int xoff,
int yoff,
int width,
int height,
float zoom,
boolean invert)
Paint the mask using the supplied Graphics component, with option to invert the mask |
void |
read(java.io.File file)
Reads a mask from a file |
void |
read(java.io.Reader r)
Reads a mask from a Reader (e.g. |
void |
setBlur(double blurLevel)
Sets the size of the Gaussian (or implementation specific) blur to apply to the mask The size specified as multiple applications of a Gaussian blur function |
void |
write(java.io.File f)
Writes the mask to a file |
void |
write(java.io.PrintWriter pw)
Writes the mask to a PrintWriter |
void |
write(java.lang.String fname)
Writes the mask to a file |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.awt.Color maskColour
public static final int CONTOUR_FORWARD
public static final int CONTOUR_REVERSE
public static final int POINT
Constructor Detail |
---|
public VectorMask()
Method Detail |
---|
public VectorMask clone()
MaskInterface
clone
in interface MaskInterface
clone
in class java.lang.Object
public void read(java.io.File file) throws java.io.FileNotFoundException, java.io.IOException
read
in interface MaskInterface
file
- The name of the mask file
java.io.FileNotFoundException
- thrown if file not found
java.io.IOException
- thrown if some other I/O errorpublic void read(java.io.Reader r) throws java.io.IOException
r
- The Reader to read from
java.io.IOException
- if an IOException occurspublic void write(java.lang.String fname) throws java.io.IOException
fname
- the name of the file to write to
java.io.IOException
public void write(java.io.File f) throws java.io.IOException
write
in interface MaskInterface
f
- the file to write to
java.io.IOException
public void write(java.io.PrintWriter pw)
pw
- the PrintWriter to write topublic java.util.Vector<java.lang.Integer> getContours()
public java.util.Vector<java.lang.Integer> getDirections()
public void add(int index, int dir)
index
- the index of the contour or point to adddir
- the direction the contour should be followed or point CONTOUR_FORWARD, CONTOUR_REVERSE or POINTpublic void delete(int index)
index
- the index of the contour to removepublic FloatImage getAsFloatImage(Template tem, int w, int h, float min, float max)
MaskInterface
getAsFloatImage
in interface MaskInterface
tem
- the template to apply the mask tow
- The width of the output mask imageh
- The height of the output mask imagemin
- The values to draw outside the masked regionsmax
- The values to draw in the masked regions
public static FloatImage getAsFloatImage(Template tem, java.util.Vector<java.lang.Integer> maskDirections, java.util.Vector<java.lang.Integer> maskConts, int w, int h, float min, float max)
public java.awt.Polygon getMask(Template tem, int xoff, int yoff, float zoom)
tem
- The template defining the lines to use in this maskxoff
- the x-offsetyoff
- the y-offsetzoom
- the zoom
public java.awt.Image maskImage(java.awt.Image img, Template tem, java.awt.Color col, boolean reverse)
maskImage
in interface MaskInterface
img
- The image to masktem
- The template to usecol
- The colour to draw in the masked regionsreverse
- If true draw outside the polygon defined by the mask, otherwise draw inside
public FloatImage maskImage(FloatImage img, Template tem, java.awt.Color col, boolean reverse)
maskImage
in interface MaskInterface
img
- The image to masktem
- The template to usecol
- The colour to draw in the masked regionsreverse
- If true draw outside the polygon defined by the mask, otherwise draw inside
public void paint(Template tem, java.awt.Graphics g, java.awt.Color col, int xoff, int yoff, int width, int height, float zoom)
paint
in interface MaskInterface
tem
- Template to form mask aroundg
- Graphics object to paint ontocol
- Colour to paint the maskxoff
- the x-offsetyoff
- the y-offsetzoom
- the zoompublic void paint(Template tem, java.awt.Graphics g, java.awt.Color col, int xoff, int yoff, int width, int height, float zoom, boolean invert)
MaskInterface
paint
in interface MaskInterface
tem
- Template to form mask aroundg
- Graphics object to paint ontocol
- Colour to paint the maskxoff
- the x-offsetyoff
- the y-offsetzoom
- the zoominvert
- will invert the mask if true.public javax.swing.filechooser.FileNameExtensionFilter getExt()
getExt
in interface MaskInterface
public void setBlur(double blurLevel)
MaskInterface
setBlur
in interface MaskInterface
public double getBlur()
MaskInterface
getBlur
in interface MaskInterface
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |