Documentation>C API
Functions
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_default_geometry (vl_size width, vl_size height)
| Get the default geometry for a given image size.
vl_bool | vl_scalespacegeometry_is_equal (VlScaleSpaceGeometry a, VlScaleSpaceGeometry b)
| Check scale space geometries for equality.
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 *self, vl_index o, vl_index s)
| Get the data of a scale space level.
float const * | vl_scalespace_get_level_const (VlScaleSpace const *self, vl_index o, vl_index s)
| Get the data of a scale space level (const).
double | vl_scalespace_get_level_sigma (VlScaleSpace const *self, vl_index o, vl_index s)
| Get the scale of a given octave and sublevel.
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)
| Create a new scale space object.
VlScaleSpace * | vl_scalespace_new_with_geometry (VlScaleSpaceGeometry geom)
| Create a new scale space with the specified geometry.
VlScaleSpace * | vl_scalespace_new_copy (VlScaleSpace *self)
| Create a new copy of the object.
VlScaleSpace * | vl_scalespace_new_shallow_copy (VlScaleSpace *self)
| Create a new shallow copy of the object.
void | vl_scalespace_delete (VlScaleSpace *self)
| Delete object.
void | _vl_scalespace_fill_octave (VlScaleSpace *self, vl_index o)
| Fill octave starting from the 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

## ◆ _vl_scalespace_fill_octave()

void _vl_scalespace_fill_octave | ( | VlScaleSpace * | self,
|  | vl_index | o )

Parameters

  self | object instance.
  o | octave to process.

The function takes the first sublevel of octave o (the one at sublevel octaveFirstLevel and iteratively smoothes it to obtain the other octave levels.

## ◆ _vl_scalespace_start_octave_from_image()

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.

## ◆ _vl_scalespace_start_octave_from_previous_octave()

void _vl_scalespace_start_octave_from_previous_octave | ( | VlScaleSpace * | self,
|  | vl_index | o )

static

Parameters

  self | object.
  o | octave to initialize.

The function initializes the first level of octave o from the content of octave `o - 1`.

## ◆ copy_and_downsample()

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.

## ◆ copy_and_upsample()

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.

## ◆ vl_scalespace_delete()

void vl_scalespace_delete | ( | VlScaleSpace * | self | ) |

Parameters

  self | object to delete.

See also
  vl_scalespace_new()

## ◆ vl_scalespace_get_default_geometry()

VlScaleSpaceGeometry vl_scalespace_get_default_geometry | ( | vl_size | width,
|  | vl_size | height )

Parameters

  width | image width.
  height | image height.

Returns
  the default scale space geometry.

Both width and height must be at least one pixel wide.

## ◆ vl_scalespace_get_geometry()

VlScaleSpaceGeometry vl_scalespace_get_geometry | ( | VlScaleSpace const * | self | ) |

Parameters

  self | object.

Returns
  the scale space geometry.

## ◆ vl_scalespace_get_level()

float * vl_scalespace_get_level | ( | VlScaleSpace * | self,
|  | vl_index | o,
|  | vl_index | s )

Parameters

  self | object.
  o | octave index.
  s | level 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`.

## ◆ vl_scalespace_get_level_const()

float const * vl_scalespace_get_level_const | ( | VlScaleSpace const * | self,
|  | vl_index | o,
|  | vl_index | s )

Parameters

  self | object.
  o | octave index.
  s | level index.

Returns
  pointer to the data for octave o, level s.

This function is the same as vl_scalespace_get_level but reutrns a `const` pointer to the data.

## ◆ vl_scalespace_get_level_sigma()

double vl_scalespace_get_level_sigma | ( | VlScaleSpace const * | self,
|  | vl_index | o,
|  | vl_index | s )

Parameters

  self | object.
  o | octave index.
  s | sublevel index.

The function returns the scale \(\sigma(o,s)\) as a function of the octave index o and sublevel s.

## ◆ vl_scalespace_get_octave_geometry()

VlScaleSpaceOctaveGeometry vl_scalespace_get_octave_geometry | ( | VlScaleSpace const * | self,
|  | vl_index | o )

Parameters

  self | object.
  o | octave index.

Returns
  the geometry of octave o.

## ◆ vl_scalespace_new()

VlScaleSpace * vl_scalespace_new | ( | vl_size | width,
|  | vl_size | height )

Parameters

  width | image width.
  height | image height.

Returns
  new scale space object.

This function is the same as vl_scalespace_new_with_geometry() but it uses vl_scalespace_get_default_geometry to initialise the geometry of the scale space from the image size.

See also
  vl_scalespace_new_with_geometry(), vl_scalespace_delete().

## ◆ vl_scalespace_new_copy()

VlScaleSpace * vl_scalespace_new_copy | ( | VlScaleSpace * | self | ) |

Parameters

  self | object to copy from.

The function returns NULL if the copy cannot be made due to an out-of-memory condition.

## ◆ vl_scalespace_new_shallow_copy()

VlScaleSpace * vl_scalespace_new_shallow_copy | ( | VlScaleSpace * | self | ) |

Parameters

  self | object to copy from.

The function works like vl_scalespace_new_copy() but only allocates the scale space, without actually copying the data.

## ◆ vl_scalespace_new_with_geometry()

VlScaleSpace * vl_scalespace_new_with_geometry | ( | VlScaleSpaceGeometry | geom | ) |

Parameters

  geom | scale space geomerty.

Returns
  new scale space object.

If the geometry is not valid (see VlScaleSpaceGeometry), the result is unpredictable.

The function returns NULL if it was not possible to allocate the object because of an out-of-memory condition.

See also
  VlScaleSpaceGeometry, vl_scalespace_delete().

## ◆ vl_scalespace_put_image()

void vl_scalespace_put_image | ( | 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.

## ◆ vl_scalespacegeometry_is_equal()

vl_bool vl_scalespacegeometry_is_equal | ( | VlScaleSpaceGeometry | a,
|  | VlScaleSpaceGeometry | b )

Parameters

  a | first geometry.
  b | second geometry.

Returns
  true if equal.