Package adams.data.image.features
Class Histogram
-
- All Implemented Interfaces:
CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,ShallowCopySupporter<AbstractImageFeatureGenerator>
,SizeOfHandler
,Serializable
,Comparable
public class Histogram extends AbstractBufferedImageFeatureGenerator
Turns an image into a histogram.
In case of an 8-bit histogram, the image must already be converted to a gray image.
The number of bins per channel can be chosen as well (1-256).
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-converter <adams.data.featureconverter.AbstractFeatureConverter> (property: converter) The feature converter to use to produce the output data. default: adams.data.featureconverter.SpreadSheet -data-row-type adams.data.spreadsheet.DenseDataRow -spreadsheet-type adams.data.spreadsheet.DefaultSpreadSheet
-prefix <java.lang.String> (property: prefix) The (optional) prefix to use for the feature names. default:
-field <adams.data.report.Field> [-field ...] (property: fields) The fields to add to the output. default:
-notes <adams.core.base.BaseString> [-notes ...] (property: notes) The notes to add as attributes to the generated data, eg 'PROCESS INFORMATION' . default:
-histo-type <GRAY|RGB|YUV|YIQ|HSV> (property: histogramType) The type of histogram to generate. default: RGB
-num-bins <int> (property: numBins) The number of bins per channel (1-256). default: 256 minimum: 1 maximum: 256
-group-channels <boolean> (property: groupChannels) If enabled, grouping is by channel rather than by bin. default: false
- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Histogram.HistogramType
The type of histogram to generate.
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_GroupChannels
whether to group the channels.protected Histogram.HistogramType
m_HistogramType
the type of histogram to generate.protected int
m_NumBins
the number of bins per channel.-
Fields inherited from class adams.data.image.AbstractImageFeatureGenerator
m_Converter, m_Fields, m_Notes, m_Prefix
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description Histogram()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HeaderDefinition
createHeader(BufferedImageContainer img)
Creates the header from a template image.void
defineOptions()
Adds options to the internal list of options.List<Object>[]
generateRows(BufferedImageContainer img)
Performs the actual feature generation.protected String[]
getChannelSuffixes()
Returns the channel suffixes to use.boolean
getGroupChannels()
Returns whether to group by channels.Histogram.HistogramType
getHistogramType()
Returns the type of histogram to generate.int
getNumBins()
Returns the number of bins to use per channel.String
globalInfo()
Returns a string describing the object.String
groupChannelsTipText()
Returns the tip text for this property.String
histogramTypeTipText()
Returns the tip text for this property.String
numBinsTipText()
Returns the tip text for this property.void
setGroupChannels(boolean value)
Sets the whether to group by channels.void
setHistogramType(Histogram.HistogramType value)
Sets the type of histogram to generate.void
setNumBins(int value)
Sets the number of bins to use per channel.-
Methods inherited from class adams.data.image.AbstractImageFeatureGenerator
checkData, cleanUp, compareTo, converterTipText, destroy, equals, fieldsTipText, generate, getConverter, getDatasetFormat, getFields, getNotes, getPrefix, getRowFormat, notesTipText, postProcessHeader, postProcessRow, postProcessRows, prefixTipText, reset, setConverter, setFields, setNotes, setPrefix, shallowCopy, shallowCopy
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, 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, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_HistogramType
protected Histogram.HistogramType m_HistogramType
the type of histogram to generate.
-
m_NumBins
protected int m_NumBins
the number of bins per channel.
-
m_GroupChannels
protected boolean m_GroupChannels
whether to group the channels.
-
-
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 classAbstractImageFeatureGenerator<BufferedImageContainer>
-
setHistogramType
public void setHistogramType(Histogram.HistogramType value)
Sets the type of histogram to generate.- Parameters:
value
- the type
-
getHistogramType
public Histogram.HistogramType getHistogramType()
Returns the type of histogram to generate.- Returns:
- the type
-
histogramTypeTipText
public String histogramTypeTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setNumBins
public void setNumBins(int value)
Sets the number of bins to use per channel.- Parameters:
value
- the number of bins
-
getNumBins
public int getNumBins()
Returns the number of bins to use per channel.- Returns:
- the number of bins
-
numBinsTipText
public String numBinsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setGroupChannels
public void setGroupChannels(boolean value)
Sets the whether to group by channels.- Parameters:
value
- true if to group by channels
-
getGroupChannels
public boolean getGroupChannels()
Returns whether to group by channels.- Returns:
- true if to group by channels
-
groupChannelsTipText
public String groupChannelsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getChannelSuffixes
protected String[] getChannelSuffixes()
Returns the channel suffixes to use.- Returns:
- the suffixes
-
createHeader
public HeaderDefinition createHeader(BufferedImageContainer img)
Creates the header from a template image.- Specified by:
createHeader
in classAbstractImageFeatureGenerator<BufferedImageContainer>
- Parameters:
img
- the image to act as a template- Returns:
- the generated header
-
generateRows
public List<Object>[] generateRows(BufferedImageContainer img)
Performs the actual feature generation.- Specified by:
generateRows
in classAbstractImageFeatureGenerator<BufferedImageContainer>
- Parameters:
img
- the image to process- Returns:
- the generated features
-
-