Class SimpleCrop
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.image.transformer.crop.AbstractCropAlgorithm
-
- adams.data.image.transformer.crop.SimpleCrop
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,CropAlgorithm<BufferedImage>
,Serializable
public class SimpleCrop extends AbstractCropAlgorithm
Simple cropping algorithm that uses a fixed window. The user either specifies a window height/width (if both non-zero) or the bottom-right corner coordinates apart from the coordinates of the top-left corner.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-top <int> (property: top) The y position of the top-left corner. default: 0 minimum: 0
-left <int> (property: left) The x position of the top-left corner. default: 0 minimum: 0
-bottom <int> (property: bottom) The y position of the bottom-right corner; use -1 to use image height. default: -1 minimum: -1
-right <int> (property: right) The x position of the bottom-right corner; use -1 to use image width. default: -1 minimum: -1
-height <int> (property: height) The height of the crop rectangle; ignored if less than 1. default: 0 minimum: 0
-width <int> (property: width) The width of the crop rectangle, ignored if less than 1. default: 0 minimum: 0
- Version:
- $Revision: 8487 $
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int
m_Bottom
the y of the bottom-right corner.protected int
m_Height
the height of the window.protected int
m_Left
the x of the top-left corner.protected int
m_Right
the x of the bottom-right corner.protected int
m_Top
the y of the top-left corner.protected int
m_Width
the width of the window.-
Fields inherited from class adams.data.image.transformer.crop.AbstractCropAlgorithm
m_BottomRight, m_TopLeft
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
Fields inherited from interface adams.data.image.CropAlgorithm
CROP_BOTTOM, CROP_LEFT, CROP_RIGHT, CROP_TOP
-
-
Constructor Summary
Constructors Constructor Description SimpleCrop()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
bottomTipText()
Returns the tip text for this property.void
defineOptions()
Adds options to the internal list of options.protected BufferedImage
doCrop(BufferedImage img)
Performs the actual cropping.int
getBottom()
Returns the y of the bottom-right corner.int
getHeight()
Returns the height of the crop rectangle.int
getLeft()
Returns the x of the top-left corner.int
getRight()
Returns the x of the bottom-right corner.int
getTop()
Returns the y of the top-left corner.int
getWidth()
Returns the width of the window.String
globalInfo()
Returns a string describing the object.String
heightTipText()
Returns the tip text for this property.String
leftTipText()
Returns the tip text for this property.String
rightTipText()
Returns the tip text for this property.void
setBottom(int value)
Sets the y of the bottom-right corner.void
setHeight(int value)
Sets the height of the crop rectangle.void
setLeft(int value)
Sets the x of the top-left corner.void
setRight(int value)
Sets the x of the bottom-right corner.void
setTop(int value)
Sets the y of the top-left corner.void
setWidth(int value)
Sets the width of the crop rectangle.String
topTipText()
Returns the tip text for this property.String
widthTipText()
Returns the tip text for this property.-
Methods inherited from class adams.data.image.transformer.crop.AbstractCropAlgorithm
check, crop, getBottomRight, getTopLeft, postCrop, preCrop
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_Top
protected int m_Top
the y of the top-left corner.
-
m_Left
protected int m_Left
the x of the top-left corner.
-
m_Bottom
protected int m_Bottom
the y of the bottom-right corner.
-
m_Right
protected int m_Right
the x of the bottom-right corner.
-
m_Height
protected int m_Height
the height of the window.
-
m_Width
protected int m_Width
the width of the window.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
setTop
public void setTop(int value)
Sets the y of the top-left corner.- Parameters:
value
- the y
-
getTop
public int getTop()
Returns the y of the top-left corner.- Returns:
- the y
-
topTipText
public String topTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLeft
public void setLeft(int value)
Sets the x of the top-left corner.- Parameters:
value
- the x
-
getLeft
public int getLeft()
Returns the x of the top-left corner.- Returns:
- the x
-
leftTipText
public String leftTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setBottom
public void setBottom(int value)
Sets the y of the bottom-right corner.- Parameters:
value
- the y
-
getBottom
public int getBottom()
Returns the y of the bottom-right corner.- Returns:
- the y
-
bottomTipText
public String bottomTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setRight
public void setRight(int value)
Sets the x of the bottom-right corner.- Parameters:
value
- the x
-
getRight
public int getRight()
Returns the x of the bottom-right corner.- Returns:
- the x
-
rightTipText
public String rightTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setHeight
public void setHeight(int value)
Sets the height of the crop rectangle.- Parameters:
value
- the height, ignored if less than 1
-
getHeight
public int getHeight()
Returns the height of the crop rectangle.- Returns:
- the height, ignored if less than 1
-
heightTipText
public String heightTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setWidth
public void setWidth(int value)
Sets the width of the crop rectangle.- Parameters:
value
- the width, ignored if less than 1
-
getWidth
public int getWidth()
Returns the width of the window.- Returns:
- the width, ignored if less than 1
-
widthTipText
public String widthTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
doCrop
protected BufferedImage doCrop(BufferedImage img)
Performs the actual cropping.- Specified by:
doCrop
in classAbstractCropAlgorithm
- Parameters:
img
- the image to crop- Returns:
- the (potentially) cropped image
-
-