00001 00007 /* 00008 Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 00009 All rights reserved. 00010 00011 This file is part of the VLFeat library and is made available under 00012 the terms of the BSD license (see the COPYING file). 00013 */ 00014 00015 #ifndef VL_QUICKSHIFT_H 00016 #define VL_QUICKSHIFT_H 00017 00018 #include "generic.h" 00019 #include "mathop.h" 00020 00022 typedef double vl_qs_type ; 00023 00025 #define VL_QS_INF VL_INFINITY_D /* Change to _F for float math */ 00026 00033 typedef struct _VlQS 00034 { 00035 vl_qs_type *image ; 00036 int height; 00037 int width; 00038 int channels; 00040 vl_bool medoid; 00041 vl_qs_type sigma; 00042 vl_qs_type tau; 00043 00044 int *parents ; 00045 vl_qs_type *dists ; 00046 vl_qs_type *density ; 00047 } VlQS ; 00048 00052 VL_EXPORT 00053 VlQS* vl_quickshift_new (vl_qs_type const * im, int height, int width, 00054 int channels); 00055 00056 VL_EXPORT 00057 void vl_quickshift_delete (VlQS *q) ; 00064 VL_EXPORT 00065 void vl_quickshift_process (VlQS *q) ; 00066 00072 VL_INLINE vl_qs_type vl_quickshift_get_max_dist (VlQS const *q) ; 00073 VL_INLINE vl_qs_type vl_quickshift_get_kernel_size (VlQS const *q) ; 00074 VL_INLINE vl_bool vl_quickshift_get_medoid (VlQS const *q) ; 00075 00076 VL_INLINE int * vl_quickshift_get_parents (VlQS const *q) ; 00077 VL_INLINE vl_qs_type * vl_quickshift_get_dists (VlQS const *q) ; 00078 VL_INLINE vl_qs_type * vl_quickshift_get_density (VlQS const *q) ; 00084 VL_INLINE void vl_quickshift_set_max_dist (VlQS *f, vl_qs_type tau) ; 00085 VL_INLINE void vl_quickshift_set_kernel_size (VlQS *f, vl_qs_type sigma) ; 00086 VL_INLINE void vl_quickshift_set_medoid (VlQS *f, vl_bool medoid) ; 00089 /* ------------------------------------------------------------------- 00090 * Inline functions implementation 00091 * ---------------------------------------------------------------- */ 00092 00100 VL_INLINE vl_qs_type 00101 vl_quickshift_get_max_dist (VlQS const *q) 00102 { 00103 return q->tau ; 00104 } 00105 00113 VL_INLINE vl_qs_type 00114 vl_quickshift_get_kernel_size (VlQS const *q) 00115 { 00116 return q->sigma ; 00117 } 00118 00125 VL_INLINE vl_bool 00126 vl_quickshift_get_medoid (VlQS const *q) 00127 { 00128 return q->medoid ; 00129 } 00130 00139 VL_INLINE int * 00140 vl_quickshift_get_parents (VlQS const *q) 00141 { 00142 return q->parents ; 00143 } 00144 00153 VL_INLINE vl_qs_type * 00154 vl_quickshift_get_dists (VlQS const *q) 00155 { 00156 return q->dists ; 00157 } 00158 00165 VL_INLINE vl_qs_type * 00166 vl_quickshift_get_density (VlQS const *q) 00167 { 00168 return q->density ; 00169 } 00170 00178 VL_INLINE void 00179 vl_quickshift_set_kernel_size (VlQS *q, vl_qs_type sigma) 00180 { 00181 q -> sigma = sigma ; 00182 } 00183 00191 VL_INLINE void 00192 vl_quickshift_set_max_dist (VlQS *q, vl_qs_type tau) 00193 { 00194 q -> tau = tau ; 00195 } 00196 00204 VL_INLINE void 00205 vl_quickshift_set_medoid (VlQS *q, vl_bool medoid) 00206 { 00207 q -> medoid = medoid ; 00208 } 00209 00210 00211 #endif