Documentation>C API
Functions
liop.c File Reference

Local Intensity Order Pattern (LIOP) descriptor - Definition. More...

`#include "liop.h"`
`#include "mathop.h"`
`#include "imopv.h"`
`#include <string.h>`
`#include "qsort-def.h"`

## Functions

vl_index | get_permutation_index (vl_uindex *permutation, vl_size size)
| Compute permutation index.
VlLiopDesc * | vl_liopdesc_new (vl_int numNeighbours, vl_int numSpatialBins, float radius, vl_size sideLength)
| Create a new LIOP object instance.
VlLiopDesc * | vl_liopdesc_new_basic (vl_size sideLength)
| Create a new object with default parameters.
void | vl_liopdesc_delete (VlLiopDesc *self)
| Delete object instance.
void | vl_liopdesc_process (VlLiopDesc *self, float *desc, float const *patch)
| Compute liop descriptor for a patch.
vl_size | vl_liopdesc_get_dimension (VlLiopDesc const *self)
| Get the dimension of a LIOP descriptor.
vl_size | vl_liopdesc_get_num_neighbours (VlLiopDesc const *self)
| Get the number of neighbours.
float | vl_liopdesc_get_intensity_threshold (VlLiopDesc const *self)
| Get the intensity threshold.
void | vl_liopdesc_set_intensity_threshold (VlLiopDesc *self, float x)
| Set the intensity threshold.
double | vl_liopdesc_get_neighbourhood_radius (VlLiopDesc const *self)
| Get the neighbourhood radius.
vl_size | vl_liopdesc_get_num_spatial_bins (VlLiopDesc const *self)
| Get the number of spatial bins.

## Detailed Description

Author
  Hana Sarbortova
  Andrea Vedaldi

## Function Documentation

## ◆ get_permutation_index()

vl_index get_permutation_index | ( | vl_uindex * | permutation,
|  | vl_size | size )

inline

Parameters

  permutation | array containing all values from 0 to (size - 1) (input/output).
  size | size of the permutation array.

Returns
  permutation index.

Compute the position of permutation in the lexycographcial sorting of permutations of the given size.

For example, in the lexicographical ordering, permutations of four elements are listed as [1 2 3 4], [1 2 4 3], [1 3 2 4], [1 3 4 2], [1 4 2 3], [1 4 3 2], [2 1 3 4], ..., [4 3 2 1].

The index can be computed as follows. First pick the first digit perm[1]. This is either 1,2,...,n. For each choice of the first digits, there are (n-1)! other permutations, separated therefore by (n-1)! elements in lexicographical order.

Process then the second digit perm[2]. This can be though as finding the lexycotraphical index of perm[2], ..., perm[n], a permutation of n-1 elements. This can be explicitly obtained by taking out 1 from all elements perm[i] > perm[1].

## ◆ vl_liopdesc_delete()

void vl_liopdesc_delete | ( | VlLiopDesc * | self | ) |

Parameters

  self | object instance.

## ◆ vl_liopdesc_get_dimension()

vl_size vl_liopdesc_get_dimension | ( | VlLiopDesc const * | self | ) |

Parameters

  self | object.

Returns
  dimension.

## ◆ vl_liopdesc_get_intensity_threshold()

float vl_liopdesc_get_intensity_threshold | ( | VlLiopDesc const * | self | ) |

Parameters

  self | object.

Returns
  intensity threshold.

See also
  liop-weighing

## ◆ vl_liopdesc_get_neighbourhood_radius()

double vl_liopdesc_get_neighbourhood_radius | ( | VlLiopDesc const * | self | ) |

Parameters

  self | object.

Returns
  neighbourhood radius.

## ◆ vl_liopdesc_get_num_neighbours()

vl_size vl_liopdesc_get_num_neighbours | ( | VlLiopDesc const * | self | ) |

Parameters

  self | object.

Returns
  number of neighbours.

## ◆ vl_liopdesc_get_num_spatial_bins()

vl_size vl_liopdesc_get_num_spatial_bins | ( | VlLiopDesc const * | self | ) |

Parameters

  self | object.

Returns
  number of spatial bins.

## ◆ vl_liopdesc_new()

VlLiopDesc * vl_liopdesc_new | ( | vl_int | numNeighbours,
|  | vl_int | numSpatialBins,
|  | float | radius,
|  | vl_size | sideLength )

Parameters

  numNeighbours | number of neighbours.
  numSpatialBins | number of bins.
  radius | radius of the cirucal sample neighbourhoods.
  sideLength | width of the input image patch (the patch is square).

Returns
  new object instance.

The value of radius should be at least less than half the sideLength of the patch.

## ◆ vl_liopdesc_new_basic()

VlLiopDesc * vl_liopdesc_new_basic | ( | vl_size | sideLength | ) |

Parameters

  sideLength | size of the patches to be processed.

Returns
  new object.

See also
  vl_liopdesc_new.

## ◆ vl_liopdesc_process()

void vl_liopdesc_process | ( | VlLiopDesc * | self,
|  | float * | desc,
|  | float const * | patch )

Parameters

  self | object instance
  desc | descriptor to be computed (output).
  patch | patch to process

Use vl_liopdesc_get_dimension to get the size of the descriptor desc.

## ◆ vl_liopdesc_set_intensity_threshold()

void vl_liopdesc_set_intensity_threshold | ( | VlLiopDesc * | self,
|  | float | x )

Parameters

  self | object.
  x | intensity threshold.

If non-negative, the threshold as is is used when comparing intensities. If negative, the absolute value of the specified number is multipled by the maximum intensity difference inside a patch to obtain the threshold.

See also
  liop-weighing