Documentation - C API
scalespace.c File Reference

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

VlScaleSpaceGeometry vl_scalespace_get_geometry (VlScaleSpace const *self)
 Get the geometry of the scale space.
VlScaleSpaceOctaveGeometry vl_scalespace_get_octave_geometry (VlScaleSpace const *self, vl_index o)
 Get the geometry of an octave of the scalespace.
float * vl_scalespace_get_level (VlScaleSpace const *self, vl_index o, vl_index s)
 Get the const data of a scale space level.
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.
VlScaleSpacevl_scalespace_new (vl_size width, vl_size height, vl_index numOctaves, vl_index firstOctave, vl_size octaveResolution, vl_index octaveFirstSubdivision, vl_index octaveLastSubdivision)
 Creates a new VlScaleSpace object.
void vl_scalespace_delete (VlScaleSpace *self)
 Delete a VlScaleSpace object.
VlScaleSpacevl_scalespace_clone (VlScaleSpace *self)
 Clone the scale space with all its data.
VlScaleSpacevl_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_put_image (VlScaleSpace *self, float const *image)
 Initialise Scale space with new image.

Detailed Description

Author:
Karel Lenc
Andrea Vedaldi
Michal Perdoch

Function Documentation

void _vl_scalespace_fill_octave ( VlScaleSpace self,
vl_index  o 
)
Parameters:
selfVlScaleSpace object instance.
ooctave 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:
selfVlScaleSpace object instance.
imageimage data.
ooctave 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:
VlScaleSpaceobjet instance.
ooctave 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:
destinationoutput imgae buffer.
sourceinput image buffer.
widthinput image width.
heightinput image height.
numOctavesoctaves (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:
destinationoutput image.
sourceinput image.
widthinput image width.
heightinput 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.

VlScaleSpace* vl_scalespace_clone ( VlScaleSpace self)

Performs deep copy of the scale space.

Parameters:
selfScale space which should be cloned.
VlScaleSpace* vl_scalespace_clone_structure ( VlScaleSpace self)
Parameters:
selfVlScaleSpace 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:
selfobject to delete.
See also:
vl_scalespace_new
VlScaleSpaceGeometry vl_scalespace_get_geometry ( VlScaleSpace const *  self)
Parameters:
object.
Returns:
the scale space geometry.
float* vl_scalespace_get_level ( VlScaleSpace const *  self,
vl_index  o,
vl_index  s 
)
Parameters:
selfobject.
ooctave index.
slevel index.
Returns:
pointer to the data for octave o, level s.

The octave index o must be in the range firstOctave to lastOctave and the scale index s must be in the range octaveFirstSubdivision to octaveLastSubdivision.

VlScaleSpaceOctaveGeometry vl_scalespace_get_octave_geometry ( VlScaleSpace const *  self,
vl_index  o 
)
Parameters:
object.
ooctave index.
Returns:
the geometry of the specified octave.
VlScaleSpace* vl_scalespace_new ( vl_size  width,
vl_size  height,
vl_index  numOctaves,
vl_index  firstOctave,
vl_size  octaveResolution,
vl_index  octaveFirstSubdivision,
vl_index  octaveLastSubdivision 
)
Parameters:
widthimage width.
heightimage height.
numOctavesnumber of octaves.
firstOctaveindex of the first octave.
numLevelsnumeber of levels per octave.
firstLevelindex of the first level.
lastLevelindex 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_put_image ( VlScaleSpace self,
float const *  image 
)
Parameters:
selfVlScaleSpace object instance.
imageimage to process.

Compute the data of all the defined octaves and scales of the scale space self.