IMAGE
- The type of image. MBFImage
and FImage
are
supported; other types might not work.@Reference(type=Article, author={"Oliva, Aude","Torralba, Antonio"}, title="Modeling the Shape of the Scene: A Holistic Representation of the Spatial Envelope", year="2001", journal="Int. J. Comput. Vision", pages={"145","","175"}, url="http://dx.doi.org/10.1023/A:1011139631724", month="May", number="3", publisher="Kluwer Academic Publishers", volume="42", customData={"issn","0920-5691","numpages","31","doi","10.1023/A:1011139631724","acmid","598462","address","Hingham, MA, USA","keywords","energy spectrum, natural images, principal components, scene recognition, spatial layout"}) public class Gist<IMAGE extends Image<?,IMAGE> & SinglebandImageProcessor.Processable<Float,FImage,IMAGE>> extends Object implements ImageAnalyser<IMAGE>
The Gist or Spatial Envelope is a very low dimensional representation of the scene. Gist encodes a set of perceptual dimensions (naturalness, openness, roughness, expansion, ruggedness) that represents the dominant spatial structure of a scene. These perceptual dimensions are reliably estimated using coarsely localized spectral information from the image.
Implementation notes: This class supports both fixed and variable size Gist. In the fixed size mode, the image is resized and centre-cropped to a pre-defined size (allowing the Gabor filters to be pre-computed and reused). In the variable size mode the Gabor filters will be re-computed as necessary if the image size changes. For computing features to compare images, fixed size mode makes more sense.
Example usage for image comparison:
FImage i1, i2 = ...
Gist
The ability to generate a visualisation of the current descriptor in the same
way as provided by the original Matlab code is given by the
visualiseDescriptor(int)
method.
Modifier and Type | Field and Description |
---|---|
int |
boundaryExtension
The amount of padding to add before convolving with the Gabor functions
|
static int |
DEFAULT_BOUNDARY_EXTENSION
The default amount of padding to apply before convolving with the Gabor
filters
|
static int |
DEFAULT_NUMBER_OF_BLOCKS
The default number spatial blocks
|
static int[] |
DEFAULT_ORIENTATIONS_PER_SCALE
The default number of filter orientations per scale (from HF to LF)
|
static int |
DEFAULT_PREFILTER_FC
The default number of cycles per image for the pre-filter Gaussian
|
static int |
DEFAULT_SIZE
Default image size (both height and width) for fixed size Gist
|
protected boolean |
fixedSize |
protected FImage[] |
gaborFilters |
protected int |
imageHeight |
protected int |
imageWidth |
int |
numberOfBlocks
The number of blocks in each direction
|
protected int[] |
orientationsPerScale |
int |
prefilterFC
The number of cycles per image for the pre-filter Gaussian
|
protected FloatFV |
response |
Modifier | Constructor and Description |
---|---|
|
Gist()
Construct a fixed size Gist extractor using the default values.
|
|
Gist(boolean fixedSize)
Construct a variable or fixed size Gist extractor using the default
values.
|
protected |
Gist(int[] orientationsPerScale) |
|
Gist(int[] orientationsPerScale,
boolean fixedSize)
Construct a variable or fixed size Gist extractor with the given number
of orientations per scale for the Gabor jet.
|
|
Gist(int width,
int height)
Construct a fixed-size Gist extractor, with the given image size and the
default number of orientations per scale for the Gabor jet.
|
|
Gist(int width,
int height,
int[] orientationsPerScale)
Construct a fixed-size Gist extractor, with the given image size and
number of orientations per scale for the Gabor jet.
|
|
Gist(int width,
int height,
int[] orientationsPerScale,
boolean fixedSize)
Construct a variable or fixed size Gist extractor with the given number
of orientations per scale for the Gabor jet.
|
Modifier and Type | Method and Description |
---|---|
void |
analyseImage(IMAGE image)
Analyse an image.
|
protected int |
computeNumberOfSamplingBlocks()
Compute the number of sampling blocks that are used for every filter.
|
protected void |
extractGist(IMAGE image) |
FloatFV |
getResponse()
Get the response vector from the previous call to
analyseImage(Image) . |
protected void |
sampleResponses(FImage image,
float[] v,
int offset)
Sample the average response from each of the blocks in the image and
insert into the vector.
|
MBFImage |
visualiseDescriptor(int height)
Compute the descriptor visualisation in the same form as the original
matlab code.
|
public static final int[] DEFAULT_ORIENTATIONS_PER_SCALE
public static final int DEFAULT_NUMBER_OF_BLOCKS
public static final int DEFAULT_PREFILTER_FC
public static final int DEFAULT_BOUNDARY_EXTENSION
public int numberOfBlocks
public int prefilterFC
public int boundaryExtension
public static final int DEFAULT_SIZE
protected FImage[] gaborFilters
protected int[] orientationsPerScale
protected boolean fixedSize
protected int imageWidth
protected int imageHeight
public Gist()
public Gist(boolean fixedSize)
fixedSize
- if true the images should be resized and croppedpublic Gist(int width, int height)
width
- the image widthheight
- the image heightpublic Gist(int width, int height, int[] orientationsPerScale)
width
- the image widthheight
- the image heightorientationsPerScale
- the number of Gabor orientations per scale (from HF to LF)public Gist(int[] orientationsPerScale, boolean fixedSize)
orientationsPerScale
- the number of Gabor orientations per scale (from HF to LF)fixedSize
- if true the images should be resized and croppedpublic Gist(int width, int height, int[] orientationsPerScale, boolean fixedSize)
width
- the image widthheight
- the image heightorientationsPerScale
- the number of Gabor orientations per scale (from HF to LF)fixedSize
- if true the images should be resized and croppedprotected Gist(int[] orientationsPerScale)
public void analyseImage(IMAGE image)
ImageAnalyser
analyseImage
in interface ImageAnalyser<IMAGE extends Image<?,IMAGE> & SinglebandImageProcessor.Processable<Float,FImage,IMAGE>>
image
- The image to process in place.protected void extractGist(IMAGE image)
protected int computeNumberOfSamplingBlocks()
numberOfBlocks
*
numberOfBlocks
, but can be overridden in combination with
sampleResponses(FImage, float[], int)
in a subclass to support
different spatial sampling strategies.protected void sampleResponses(FImage image, float[] v, int offset)
computeNumberOfSamplingBlocks()
should also be overridden).image
- the image to samplev
- the vector to write intooffset
- the offset from which to samplepublic MBFImage visualiseDescriptor(int height)
height
- the desired height of the produced imagepublic FloatFV getResponse()
analyseImage(Image)
.