Documentation>C API
Functions
quickshift.c File Reference

Quick shift - Definition. More...

`#include "quickshift.h"`
`#include "mathop.h"`
`#include <string.h>`
`#include <math.h>`
`#include <stdio.h>`

## Functions

vl_qs_type | vl_quickshift_distance (vl_qs_type const *I, int N1, int N2, int K, int i1, int i2, int j1, int j2)
| Computes the accumulated channel L2 distance between i,j + the distance between i,j. More...
vl_qs_type | vl_quickshift_inner (vl_qs_type const *I, int N1, int N2, int K, int i1, int i2, int j1, int j2)
| Computes the accumulated channel inner product between i,j + the distance between i,j. More...
VlQS * | vl_quickshift_new (vl_qs_type const *image, int height, int width, int channels)
| Create a quick shift object. More...
void | vl_quickshift_process (VlQS *q)
| Create a quick shift objet. More...
void | vl_quickshift_delete (VlQS *q)
| Delete quick shift object. More...

## Detailed Description

Author
  Brian Fulkerson
  Andrea Vedaldi

## Function Documentation

## ◆ vl_quickshift_delete()

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

Parameters

  q | quick shift object.

## ◆ vl_quickshift_distance()

vl_qs_type vl_quickshift_distance | ( | vl_qs_type const * | I,
|  | int | N1,
|  | int | N2,
|  | int | K,
|  | int | i1,
|  | int | i2,
|  | int | j1,
|  | int | j2
| ) |  |

inline

Parameters

  I | input image buffer
  N1 | size of the first dimension of the image
  N2 | size of the second dimension of the image
  K | number of channels
  i1 | first dimension index of the first pixel to compare
  i2 | second dimension of the first pixel
  j1 | index of the second pixel to compare
  j2 | second dimension of the second pixel

Takes the L2 distance between the values in I at pixel i and j, accumulating along K channels and adding in the distance between i,j in the image.

Returns
  the distance as described above

## ◆ vl_quickshift_inner()

vl_qs_type vl_quickshift_inner | ( | vl_qs_type const * | I,
|  | int | N1,
|  | int | N2,
|  | int | K,
|  | int | i1,
|  | int | i2,
|  | int | j1,
|  | int | j2
| ) |  |

inline

Parameters

  I | input image buffer
  N1 | size of the first dimension of the image
  N2 | size of the second dimension of the image
  K | number of channels
  i1 | first dimension index of the first pixel to compare
  i2 | second dimension of the first pixel
  j1 | index of the second pixel to compare
  j2 | second dimension of the second pixel

Takes the channel-wise inner product between the values in I at pixel i and j, accumulating along K channels and adding in the inner product between i,j in the image.

Returns
  the inner product as described above

## ◆ vl_quickshift_new()

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`.

## ◆ vl_quickshift_process()

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

Parameters

  q | quick shift object.