VLFeat - Documentation > C API

# VLFeat.org

Documentation> C API

- Main Page
- Related Pages
- Data Structures
- Files

- File List
- Globals

Data Structures | Macros | Typedefs
quickshift.h File Reference

Quick shift (Quick shift image segmentation) More...

`#include "generic.h"`
`#include "mathop.h"`

## Data Structures

struct | VlQS
| quick shift results More...

## Macros

#define | VL_QS_INF VL_INFINITY_D /* Change to _F for float math */
| quick shift infinity constant

## Typedefs

typedef double | vl_qs_type
| quick shift datatype

## Functions

Create and destroy
VlQS * | vl_quickshift_new (vl_qs_type const *im, int height, int width, int channels)
| Create a quick shift object. More...
void | vl_quickshift_delete (VlQS *q)
| Delete quick shift object. More...
Process data
void | vl_quickshift_process (VlQS *q)
| Create a quick shift objet. More...
Retrieve data and parameters
vl_qs_type | vl_quickshift_get_max_dist (VlQS const *q)
| Get tau. More...
vl_qs_type | vl_quickshift_get_kernel_size (VlQS const *q)
| Get sigma. More...
vl_bool | vl_quickshift_get_medoid (VlQS const *q)
| Get medoid. More...
int * | vl_quickshift_get_parents (VlQS const *q)
| Get parents. More...
vl_qs_type * | vl_quickshift_get_dists (VlQS const *q)
| Get dists. More...
vl_qs_type * | vl_quickshift_get_density (VlQS const *q)
| Get density. More...
Set parameters
void | vl_quickshift_set_max_dist (VlQS *q, vl_qs_type tau)
| Set max distance. More...
void | vl_quickshift_set_kernel_size (VlQS *q, vl_qs_type sigma)
| Set sigma. More...
void | vl_quickshift_set_medoid (VlQS *q, vl_bool medoid)
| Set medoid. More...

## Detailed Description

Author
  Andrea Vedaldi
  Brian Fulkerson

## Function Documentation

void vl_quickshift_delete | ( | VlQS * | q | ) |

Parameters

  q | quick shift object.

vl_qs_type * vl_quickshift_get_density | ( | VlQS const * | q | ) |

inline

Parameters

  q | quick shift object.

Returns
  the estimate of the density at each pixel.

vl_qs_type * vl_quickshift_get_dists | ( | VlQS const * | q | ) |

inline

Parameters

  q | quick shift object.

Returns
  for each pixel, the distance in feature space to the pixel that is its parent in the quick shift tree. The distance is set to 'inf' if the pixel is a root node.

vl_qs_type vl_quickshift_get_kernel_size | ( | VlQS const * | q | ) |

inline

Parameters

  q | quick shift object.

Returns
  the standard deviation of the kernel used in the Parzen density estimate.

vl_qs_type vl_quickshift_get_max_dist | ( | VlQS const * | q | ) |

inline

Parameters

  q | quick shift object.

Returns
  the maximum distance in the feature space between nodes in the quick shift tree.

vl_bool vl_quickshift_get_medoid | ( | VlQS const * | q | ) |

inline

Parameters

  q | quick Shift object.

Returns
  `true` if medoid shift is used instead of quick shift.

int * vl_quickshift_get_parents | ( | VlQS const * | q | ) |

inline

Parameters

  q | quick shift object.

Returns
  a `height` x `width` matrix where each element contains the linear index of its parent node. The node is a root if its value is its own linear index.

VlQS* vl_quickshift_new | ( | vl_qs_type const * | image,
|  | int | height,
|  | int | width,
|  | int | channels
| ) |  |

Parameters

  image | the image.
  height | the height (number of rows) of the image.
  width | the width (number of columns) of the image.
  channels | the number of channels of the image.

Returns
  new quick shift object.

The `image` is an array of vl_qs_type values with three dimensions (respectively `widht`, `height`, and `channels`). Typically, a color (e.g, RGB) image has three channels. The linear index of a pixel is computed with: `channels` * `width*` `height` + `row` + `height` * `col`.

void vl_quickshift_process | ( | VlQS * | q | ) |

Parameters

  q | quick shift object.

void vl_quickshift_set_kernel_size | ( | VlQS * | q,
|  | vl_qs_type | sigma
| ) |  |

inline

Parameters

  q | quick shift object.
  sigma | standard deviation of the kernel used in the Parzen density estimate.

void vl_quickshift_set_max_dist | ( | VlQS * | q,
|  | vl_qs_type | tau
| ) |  |

inline

Parameters

  q | quick shift object.
  tau | the maximum distance in the feature space between nodes in the quick shift tree.

void vl_quickshift_set_medoid | ( | VlQS * | q,
|  | vl_bool | medoid
| ) |  |

inline

Parameters

  q | quick shift object.
  medoid | `true` to use kernelized medoid shift, `false` (default) uses quick shift.