/usr/include/vl/quickshift.h is in libvlfeat-dev 0.9.20+dfsg0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | /** @file quickshift.h
** @brief Quick shift (@ref quickshift)
** @author Andrea Vedaldi
** @author Brian Fulkerson
**/
/*
Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson.
All rights reserved.
This file is part of the VLFeat library and is made available under
the terms of the BSD license (see the COPYING file).
*/
#ifndef VL_QUICKSHIFT_H
#define VL_QUICKSHIFT_H
#include "generic.h"
#include "mathop.h"
/** @brief quick shift datatype */
typedef double vl_qs_type ;
/** @brief quick shift infinity constant */
#define VL_QS_INF VL_INFINITY_D /* Change to _F for float math */
/** ------------------------------------------------------------------
** @brief quick shift results
**
** This implements quick shift mode seeking.
**/
typedef struct _VlQS
{
vl_qs_type *image ; /**< height x width x channels feature image */
int height; /**< height of the image */
int width; /**< width of the image */
int channels; /**< number of channels in the image */
vl_bool medoid;
vl_qs_type sigma;
vl_qs_type tau;
int *parents ;
vl_qs_type *dists ;
vl_qs_type *density ;
} VlQS ;
/** @name Create and destroy
** @{
**/
VL_EXPORT
VlQS* vl_quickshift_new (vl_qs_type const * im, int height, int width,
int channels);
VL_EXPORT
void vl_quickshift_delete (VlQS *q) ;
/** @} */
/** @name Process data
** @{
**/
VL_EXPORT
void vl_quickshift_process (VlQS *q) ;
/** @} */
/** @name Retrieve data and parameters
** @{
**/
VL_INLINE vl_qs_type vl_quickshift_get_max_dist (VlQS const *q) ;
VL_INLINE vl_qs_type vl_quickshift_get_kernel_size (VlQS const *q) ;
VL_INLINE vl_bool vl_quickshift_get_medoid (VlQS const *q) ;
VL_INLINE int * vl_quickshift_get_parents (VlQS const *q) ;
VL_INLINE vl_qs_type * vl_quickshift_get_dists (VlQS const *q) ;
VL_INLINE vl_qs_type * vl_quickshift_get_density (VlQS const *q) ;
/** @} */
/** @name Set parameters
** @{
**/
VL_INLINE void vl_quickshift_set_max_dist (VlQS *f, vl_qs_type tau) ;
VL_INLINE void vl_quickshift_set_kernel_size (VlQS *f, vl_qs_type sigma) ;
VL_INLINE void vl_quickshift_set_medoid (VlQS *f, vl_bool medoid) ;
/** @} */
/* -------------------------------------------------------------------
* Inline functions implementation
* ---------------------------------------------------------------- */
/** ------------------------------------------------------------------
** @brief Get tau.
** @param q quick shift object.
** @return the maximum distance in the feature space between nodes in the
** quick shift tree.
**/
VL_INLINE vl_qs_type
vl_quickshift_get_max_dist (VlQS const *q)
{
return q->tau ;
}
/** ------------------------------------------------------------------
** @brief Get sigma.
** @param q quick shift object.
** @return the standard deviation of the kernel used in the Parzen density
** estimate.
**/
VL_INLINE vl_qs_type
vl_quickshift_get_kernel_size (VlQS const *q)
{
return q->sigma ;
}
/** ------------------------------------------------------------------
** @brief Get medoid.
** @param q quick Shift object.
** @return @c true if medoid shift is used instead of quick shift.
**/
VL_INLINE vl_bool
vl_quickshift_get_medoid (VlQS const *q)
{
return q->medoid ;
}
/** ------------------------------------------------------------------
** @brief Get parents.
** @param q quick shift object.
** @return a @c height x @c 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.
**/
VL_INLINE int *
vl_quickshift_get_parents (VlQS const *q)
{
return q->parents ;
}
/** ------------------------------------------------------------------
** @brief Get dists.
** @param q quick shift object.
** @return 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_INLINE vl_qs_type *
vl_quickshift_get_dists (VlQS const *q)
{
return q->dists ;
}
/** ------------------------------------------------------------------
** @brief Get density.
** @param q quick shift object.
** @return the estimate of the density at each pixel.
**/
VL_INLINE vl_qs_type *
vl_quickshift_get_density (VlQS const *q)
{
return q->density ;
}
/** ------------------------------------------------------------------
** @brief Set sigma
** @param q quick shift object.
** @param sigma standard deviation of the kernel used in the Parzen density
** estimate.
**/
VL_INLINE void
vl_quickshift_set_kernel_size (VlQS *q, vl_qs_type sigma)
{
q -> sigma = sigma ;
}
/** ------------------------------------------------------------------
** @brief Set max distance
** @param q quick shift object.
** @param tau the maximum distance in the feature space between nodes in the
** quick shift tree.
**/
VL_INLINE void
vl_quickshift_set_max_dist (VlQS *q, vl_qs_type tau)
{
q -> tau = tau ;
}
/** ------------------------------------------------------------------
** @brief Set medoid
** @param q quick shift object.
** @param medoid @c true to use kernelized medoid shift, @c false (default) uses
** quick shift.
**/
VL_INLINE void
vl_quickshift_set_medoid (VlQS *q, vl_bool medoid)
{
q -> medoid = medoid ;
}
#endif
|