Source: http://www.cnblogs.com/justany/archive/2012/12/06/2804211.html
A scene feature description
Scene feature description?
The usual characteristic descriptor is to describe the local feature of the picture, it is not feasible to describe the scene in this way.
For example, "there are some pedestrians on the street" this scene, we must through the local features to identify whether the image has streets, pedestrians and other objects, and then determine whether this is satisfied with the scene. But this calculation is undoubtedly huge, and eigenvectors can be too large to store in memory.
For example, even using gist for 1MB image data search, 3.8GB of RAM space is required.
--evaluation of GIST descriptors for Webscale image search Talk
This forces us to need a more "macroscopic" characterization approach, which ignores the local characteristics of the image. For example: We don't need to know how many people are in those positions in the image, or what other objects there are.
So how do you define a "macro" scenario feature description?
We note that:
Most cities look like the sky and the ground are tightly connected by the outer walls of buildings; most highways look like a large surface stretch of the skyline, filled with concave (vehicles), while forest scenes will be included in a closed environment, with vertical structures as backgrounds (trees), and connected to a certain textured horizontal surface (grass).
In this way, the spatial envelope can characterize this information to some degree.
Description of five spatial envelopes
We define the following five ways to describe spatial envelopes:
- naturalness (Degree of naturalness): If the scene contains a height of horizontal and vertical lines, this indicates that the scene has obvious artificial traces, usually natural scenes with textured areas and undulating contours. Therefore, the edge has a height perpendicular to the horizontal inclination of the natural degree is low, the inverse natural degree is high.
- Openness (degree of openness): whether the space envelope is closed (or surrounded). Closed, for example: Forest, mountain, city center. Or broad, open, for example: coasts, highways.
- Roughness (degree of roughness): mainly refers to the particle size of the main constituent components. This depends on the size of the elements in each space, the likelihood of them building more complex elements, the structural relationships between the elements being built, and so on. Roughness is related to the fractal dimension of the scene, so it can be called complexity.
- Expansion degree (degree of Expansion): Parallel lines converge, and the depth characteristics of spatial gradients are given. For example, buildings in a flat view have a low degree of expansion. On the contrary, very long streets have high swelling.
- Degree of steepness (degree of ruggedness): that is, the offset from the horizontal line. (for example, a flat horizontal ground on a mountainous landscape with steep ground). The steep contours of the image are produced in a precipitous environment, and the horizon line is hidden. Most man-made environments build flat ground. Therefore, most of the steep environment is natural.
Based on these five points, the image is characterized.
This article is not intended to delve into the gist algorithm, see reference 1 for specific algorithms.
MATLAB implementation
Reference 2 provides a MATLAB implementation.
For example, the gist feature description is computed using a picture, which can be written in the case of Lmgist:
% Read image img = imread (' demo2.jpg ');% set gist parameter Clear Paramparam.orientationsperscale = [8 8 8 8]; % number of orientations per scale (from HF to LF) param.numberblocks = 4;param.fc_prefilt = 4;% calculation gist[gist, param] = LMGI St (IMG, ', param);
Please refer to resources 2 for details.
C implementation
- First download its provided Lear ' s GIST implementation in Lear.
Since it is based on FFTW3 (the Faster Fourier Transform in the West), we also need to install FFTW3 first.
- Download a suitable version of FFTW3 on the download page.
- Linux or Mac needs to configure the floating point version when the terminal is running configure (Windows has not tried, but Lear's GIST implementation's Readme explains that it only runs on Linux and Mac, So there's no windows install this ... ), i.e.
./configure--enable-single
Make
Make check
sudo make install
- Compiling Lear ' s GIST implementation
Need to be makefile:
Compute_gist:compute_gist.c GIST.O standalone_image.ogcc-wall-g-o [email protected] $^ $ (wfftlib)-lfftw3f
Add-lm, change to:
Compute_gist:compute_gist.c GIST.O standalone_image.ogcc-wall-g-o [email protected] $^ $ (wfftlib)-LFFTW3F-LM
And then:
Make
- The Compute_gist program is generated, and the PPM picture can be gist calculated. For example, in terminal input:
./compute_gist ar.ppm
There will be 960 floating-point numbers, as follows:
0.0579 0.1926 0.0933 0.0662 .....
......
.... 0.0563 0.0575 0.0640
Precautions
- The input image must be a picture of the original (that is, binary) pgm/ppm format.
- The size of the input image must be the same, otherwise the calculated gist is meaningless.
- Through the SVM training to carry on the picture detection, 2001 that paper obtains 83.7% judgement accuracy.
Resources
Modeling the Shape of the scene:a holistic representation of the Spatial Envelope. Aude Oliva & Antonio Torralba. January 22, 2001
Modeling the shape of the scene:a holistic representation of the spatial envelope DEMO
Gist feature Descriptor use