Scale Space - Definition. More...
#include "scalespace.h"#include "mathop.h"#include <assert.h>#include <stdlib.h>#include <string.h>#include <math.h>#include <stdio.h>Functions | |
| static void | copy_and_upsample (float *destination, float const *source, vl_size width, vl_size height) |
| Upsample the rows and take the transpose. | |
| static void | copy_and_downsample (float *destination, float const *source, vl_size width, vl_size height, vl_size numOctaves) |
| Downsample. | |
| VlScaleSpace * | vl_scalespace_new (vl_size width, vl_size height, vl_index numOctaves, vl_index firstOctave, vl_size numLevels, vl_index firstLevel, vl_index lastLevel) |
| Creates a new VlScaleSpace object. | |
| void | vl_scalespace_delete (VlScaleSpace *self) |
| Delete a VlScaleSpace object. | |
| VlScaleSpace * | vl_scalespace_clone (VlScaleSpace *self) |
| Clone the scale space with all its data. | |
| VlScaleSpace * | vl_scalespace_clone_structure (VlScaleSpace *self) |
| Clone the object but do not copy the data. | |
| void | _vl_scalespace_fill_octave (VlScaleSpace *self, vl_index o) |
| Fill octave startinf from first level. | |
| static void | _vl_scalespace_start_octave_from_image (VlScaleSpace *self, float const *image, vl_index o) |
| Initialize the first level of an octave from an image. | |
| static void | _vl_scalespace_start_octave_from_previous_octave (VlScaleSpace *self, vl_index o) |
| Initialize the first level of an octave from the previous octave. | |
| void | vl_scalespace_init (VlScaleSpace *self, float const *image) |
| Initialise Scale space with new image. | |
| void | vl_scalespace_apply (VlScaleSpace const *self, VlScaleSpace *dst, VlScaleSpaceCallback *callback, void *params) |
| Apply a function to all levels of the scale space. | |
| void | vl_scalespace_diff (VlScaleSpace const *self, VlScaleSpace *dst) |
| Compute the scale derivative. | |
| void | vl_scalespace_find_local_extrema (VlScaleSpace *self, double peakThreshold, vl_size borderSize) |
| Detect local extrema. | |
| int | vl_scalespace_extract_affine_patch (VlScaleSpace *self, float *patch, vl_size patchWidth, vl_size patchHeight, double patchSigma, double t1, double t2, double a11, double a21, double a12, double a22) |
| void | vl_scalespace_refine_local_extrema (VlScaleSpace *self, double peakThreshold, double edgeThreshold, vl_size borderSize) |
| Refine local extrema. | |
| void | vl_scalespace_frame_init (VlScaleSpace const *self, VlScaleSpaceFrame *frame, double x, double y, double sigma) |
| Initialize a frame from its position and scale. | |
| void | vl_compute_gauss_mask (float *mask, int width, float sigma) |
| Compute Gaussian mask. | |
| int | get_eigen_values (float a, float b, float c, float d, float *l1, float *l2) |
| Get real-valued Eigen-values of 2x2 matrix [a,b;c,d]. | |
| VlAffineShapeEstimator * | vl_affineshapeestimator_new (vl_size win_size) |
| Create a new VlAffineShapeEstimator object instance. | |
| void | vl_affineshapeestimator_delete (VlAffineShapeEstimator *f) |
| Delete Affine shape estimator filter. | |
| int | vl_affineshapeestimator_interpolate_bilinear (const float *image, vl_size width, vl_size height, double tx, double ty, double a11, double a12, double a21, double a22, float *dst, vl_size dstWidth, vl_size dstHeight) |
| Get affinely-warped rectangular patch with bilinear interpolation. | |
| int | vl_affineshapeestimator_estimate (VlAffineShapeEstimator *self, VlScaleSpace *scsp, VlScaleSpaceFrame const *frame, VlAffineShapeEstimatorFrame *affineFrame) |
| Estimate an affine shape on a given frame. | |
Detailed Description
Function Documentation
| void _vl_scalespace_fill_octave | ( | VlScaleSpace * | self, |
| vl_index | o | ||
| ) |
- Parameters:
-
self VlScaleSpace object instance. o octave to process.
The function takes the first level of octave o and iteratively smoothes it to obtain the other octave levels.
| static void _vl_scalespace_start_octave_from_image | ( | VlScaleSpace * | self, |
| float const * | image, | ||
| vl_index | o | ||
| ) | [static] |
- Parameters:
-
self VlScaleSpace object instance. image image data. o octave to start.
The function initializes the first level of octave o from image image. The dimensions of the image are the ones set during the creation of the VlScaleSpace object instance.
| static void _vl_scalespace_start_octave_from_previous_octave | ( | VlScaleSpace * | self, |
| vl_index | o | ||
| ) | [static] |
- Parameters:
-
VlScaleSpace objet instance. o octave to initialize.
The function initializes the first level of octave o from the content of octave o - 1.
| static void copy_and_downsample | ( | float * | destination, |
| float const * | source, | ||
| vl_size | width, | ||
| vl_size | height, | ||
| vl_size | numOctaves | ||
| ) | [static] |
- Parameters:
-
destination output imgae buffer. source input image buffer. width input image width. height input image height. numOctaves octaves (non negative).
The function downsamples the image d times, reducing it to 1/2^d of its original size. The parameters width and height are the size of the input image. The destination image dst is assumed to be floor(width/2^d) pixels wide and floor(height/2^d) pixels high.
| static void copy_and_upsample | ( | float * | destination, |
| float const * | source, | ||
| vl_size | width, | ||
| vl_size | height | ||
| ) | [static] |
- Parameters:
-
destination output image. source input image. width input image width. height input image height.
The output image has dimensions height by 2 width (so the destination buffer must be at least as big as two times the input buffer).
Upsampling is performed by linear interpolation.
| int get_eigen_values | ( | float | a, |
| float | b, | ||
| float | c, | ||
| float | d, | ||
| float * | l1, | ||
| float * | l2 | ||
| ) | [inline] |
- Parameters:
-
a,b,c,d Matrix values. l1 Pointer to first eigen value. l2 Pointer to second eigen value.
- Returns:
- 1 if the eigen values are real numbers. 0 if not or zero.
| void vl_affineshapeestimator_delete | ( | VlAffineShapeEstimator * | f | ) |
- Parameters:
-
f Affine shape estimator to delete.
The function frees the resources allocated by ::vl_affine_new().
| int vl_affineshapeestimator_estimate | ( | VlAffineShapeEstimator * | self, |
| VlScaleSpace * | scsp, | ||
| VlScaleSpaceFrame const * | frame, | ||
| VlAffineShapeEstimatorFrame * | affineFrame | ||
| ) |
- Parameters:
-
f Affine estimator filter blur Scale-space plane where the frame was found width Width of the blur plane height Height of the blur plane x x-coordinate of a frame in the blur plane y y-coordinate of a frame in the blur plane s Scale of the frame in its octave
| int vl_affineshapeestimator_interpolate_bilinear | ( | const float * | image, |
| vl_size | width, | ||
| vl_size | height, | ||
| double | tx, | ||
| double | ty, | ||
| double | a11, | ||
| double | a12, | ||
| double | a21, | ||
| double | a22, | ||
| float * | dst, | ||
| vl_size | dstWidth, | ||
| vl_size | dstHeight | ||
| ) |
- Parameters:
-
src input image. width width of input image. height height of input image. tx x-coordinate of the patch center. ty y-coordinate of the patch center. a11 component of the linear map. a12 component of the linear map. a21 component of the linear map. a22 component of the linear map. dst output image. dstWidth width of the output image. dstHeight height of the output image.
Interpolates affine neighbourhood of a point
from the src image into the image according to affine trasnformation matrix
. The size of the interpolated neighbourhood is defined by the size of the $a dst image $a dst_width and $a dstHeight and of course by the properties of the affine transformation.
Interpolate affine neighbourhood
of image
to the image
such that:
Where the more precise values of dst are found using bilinear interpolation.
- Returns:
- !=0 if the region touches the boundary of the input
| VlAffineShapeEstimator* vl_affineshapeestimator_new | ( | vl_size | win_size | ) |
- Parameters:
-
win_size size of the patch used for affine shape estimation
- Returns:
- new object instance.
The function allocates and initialises a new VlAffineShapeEstimator object instance for the specified size of the The function allocates and returns a new Affine shape estimator with the specified size of the window used for calculating the second moment matrix (SMM).
- See also:
- ::vl_affine_delete().
| void vl_compute_gauss_mask | ( | float * | mask, |
| int | width, | ||
| float | sigma | ||
| ) | [inline] |
- Parameters:
-
msk Pointer to mask image width Width of the mask height Height of the mask sigma Standard deviation of the Gauss. function
| void vl_scalespace_apply | ( | VlScaleSpace const * | self, |
| VlScaleSpace * | dst, | ||
| VlScaleSpaceCallback * | callback, | ||
| void * | params | ||
| ) |
- Parameters:
-
self VlScaleSpace object instance. dst Destination callback Callback applied to all planes params Pointer to auxiliar callback params
This function apply a callback to all the layers of scale space self and stores the result to the scale space res. self and res must have the same number of octaves and number of levels in each octave. The size of particular planes can differ however must be handled by the callback.
| VlScaleSpace* vl_scalespace_clone | ( | VlScaleSpace * | self | ) |
Performs deep copy of the scale space.
- Parameters:
-
self Scale space which should be cloned.
| VlScaleSpace* vl_scalespace_clone_structure | ( | VlScaleSpace * | self | ) |
- Parameters:
-
self VlScaleSpace object instance.
- Returns:
- the object copy, or
NULL.
The function can fail if the memory is insufficient to hold the object copy. In this case, the function returns NULL.
| void vl_scalespace_delete | ( | VlScaleSpace * | self | ) |
- Parameters:
-
self object to delete.
- See also:
- vl_scalespace_new
| void vl_scalespace_diff | ( | VlScaleSpace const * | self, |
| VlScaleSpace * | dst | ||
| ) |
- Parameters:
-
self VlScaleSpace object instance to differentiate. dst output VlScaleSpace object instance.
This function computes the differences of the scale level of the scale space and stores the result to a second scale sapce dst. If the scale space is a Gaussian scale space, then dst results in the so called Difference of Gaussian (DoG).
The geometry of dst must be compatible with the geometry of the scale space self. Specifically, the size of dst must be identical to the size of the scale space expect for the fact that there is one scale level less per octave:
vl_scalespace_get_level_min(self) = vl_scalespace_get_level_min(dst) + 1
| int vl_scalespace_extract_affine_patch | ( | VlScaleSpace * | self, |
| float * | patch, | ||
| vl_size | patchWidth, | ||
| vl_size | patchHeight, | ||
| double | patchSigma, | ||
| double | t1, | ||
| double | t2, | ||
| double | a11, | ||
| double | a21, | ||
| double | a12, | ||
| double | a22 | ||
| ) |
- Parameters:
-
self VlScaleSpace object instance. peakThreshold peak threshold. edgeThreshold edge threshold. borderSize boderd size.
- Returns:
- status.
This function filters and adjust with sub-pixel accuracy the local extrema found by vl_scalespace_find_local_extrema().
The function returns VL_ERR_ALLOC if there is not enough free memory to complete the operation.
| void vl_scalespace_find_local_extrema | ( | VlScaleSpace * | self, |
| double | peakThreshold, | ||
| vl_size | borderSize | ||
| ) |
- Parameters:
-
self VlScaleSpace object. peakThreshold borderSize The function detects the local extrema in the scale space and stores the result in the internal feature frame buffer. The feature frames can be retrieved by vl_scalespace_get_frames.
- See also:
- vl_scalespace_find_local_extrema()
| void vl_scalespace_frame_init | ( | VlScaleSpace const * | self, |
| VlScaleSpaceFrame * | frame, | ||
| double | x, | ||
| double | y, | ||
| double | sigma | ||
| ) |
- Parameters:
-
f Scale space object. k Scale space frame (output). x x coordinate of the frame center. y y coordinate of the frame center. sigma frame scale.
The function initializes a frame structure k from the location x and y and the scale sigma of the frame. The frame structure maps the frame to an octave and scale level of the discretized Gaussian scale space, which is required for instance to compute the frame SIFT descriptor.
- Algorithm
The formula linking the frame scale sigma to the octave and scale indexes is
In addition to the scale index s (which can be fractional due to scale interpolation) a frame has an integer scale index is too (which is the index of the scale level where it was detected in the DoG scale space). We have the constraints (sift-tech-detector see also the "SIFT detector"):
- o is integer in the range
. - is is integer in the range
. This depends on how the scale is determined during detection, and must be so here because gradients are computed only for this range of scale levels and are required for the calculation of the SIFT descriptor.
for detected frames in most cases due to the interpolation technique used during detection. However this is not necessary.
Thus octave o represents scales
. Note that some scales may be represented more than once. For each scale, we select the largest possible octave that contains it, i.e.
and then
In practice, both
and
are clamped to their feasible range as determined by the SIFT filter parameters.
| void vl_scalespace_init | ( | VlScaleSpace * | self, |
| float const * | image | ||
| ) |
- Parameters:
-
self VlScaleSpace object instance. image image to process.
Compute the data of all the defined octaves and scales of the scale space self.
| VlScaleSpace* vl_scalespace_new | ( | vl_size | width, |
| vl_size | height, | ||
| vl_index | numOctaves, | ||
| vl_index | firstOctave, | ||
| vl_size | numLevels, | ||
| vl_index | firstLevel, | ||
| vl_index | lastLevel | ||
| ) |
- Parameters:
-
width image width. height image height. numOctaves number of octaves. firstOctave index of the first octave. numLevels numeber of levels per octave. firstLevel index of the first level. lastLevel index of the last level.
- Returns:
- the new scale space.
The function allocates and returns a new VlScaleSpace object of the specified geometry.
If numOctaves is a negative number, the number of octaves is selected to the maximum possible given the size of the image.
Parameters firstLevel and lastLevel allow to define additional levels on top or bottom of the scale-space although the scale-space would be calculated with parameters based on numLevels. This is for example used when we need to compute additional levels for local extrema localisation when e.g.:
numLevels = 3, firstLevel = -1, lastLevel = 3
would create scale space with 5 levels indexed as:
-1 0 1 2 3
- See also:
- vl_scalespace_delete().
| void vl_scalespace_refine_local_extrema | ( | VlScaleSpace * | self, |
| double | peakThreshold, | ||
| double | edgeThreshold, | ||
| vl_size | borderSize | ||
| ) |
- Parameters:
-
self VlScaleSpace object instance. peakThreshold peak threshold. edgeThreshold edge threshold. borderSize boderd size.
This function filters and adjust with sub-pixel accuracy the local extrema found by vl_scalespace_find_local_extrema().
- See also:
- vl_scalespace_find_local_extrema()
Index GSS
Index matrix A