/** * @file LocalFeatureSift.h * @brief local feature with sift * @author Erik Rodner * @date 03/10/2012 (Eric Bach) * @note some notes to the use of siftGPU (added by Eric Bach) * - install cudaSift & siftGPU (see Makefile.config) * - add to libdepend.inc: $(call PKG_DEPEND_EXT, CUDASIFT) to specify: -DNICE_USELIB_CUDASIFT as compilerflag * - add to section [LFSiftPP] use_siftgpu=true (or 'false' to disable the gpu-support) * * If you use the gpu-support just one device is supported until now. * If your device do not support the siftGPU completly the class switch to "normal" sift. * It is possible to compile this class without siftGPU, but then you must not specify the flag: -DNICE_USELIB_CUDASIFT. */ #ifndef LOCALFEATURESIFTINCLUDE #define LOCALFEATURESIFTINCLUDE // NICE includes #include #include #include "LocalFeature.h" #include "sift.h" // std includes #include #include #include // SiftGPU & GL #ifdef NICE_USELIB_CUDASIFT #include #include #endif namespace OBJREC { /** local feature with sift */ class LocalFeatureSift : public LocalFeature { private: const Config* conf; protected: int octaves; int levels; bool normalizeFeature; int first_octave; double magnif; bool deletemode; bool integerValues; // for SiftGPU bool usegpu; float threshold; float edgeThreshold; void withPP( const NICE::Image & img, VVector & positions, VVector & descriptors ) const; #ifdef NICE_USELIB_CUDASIFT void withGPU( const NICE::Image & img, VVector & positions, VVector & descriptors ) const; #endif public: /** simple constructor */ LocalFeatureSift ( const Config *conf ); /** simple destructor */ virtual ~LocalFeatureSift(); /** * returns the size of each the SIFT-Feature * @return 128 */ int getDescSize() const { return 128; }; //! returns true if gpu is used bool isGpuUsed() const { #ifdef NICE_USELIB_CUDASIFT return usegpu; #else return false; #endif }; /** * get the descriptor * @param img input image * @param positions positions for the SIFT features * @param descriptors output * @return 0 */ virtual int getDescriptors ( const NICE::Image & img, VVector & positions, VVector & descriptors ) const; /** * computes the descriptor for a single image * @param img * @param positions * @param descriptors */ void computeDesc( const NICE::Image & img, VVector & positions, VVector & descriptors ) const; /** * sort positions by scales for faster computing of the Keypoint orientation * @param positions */ void sortPositions(VVector & positions) const; void visualizeFeatures ( NICE::Image & mark, const VVector & positions, size_t color ) const; }; } // namespace #endif