ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ProgramCU.h
Go to the documentation of this file.
1 // File: ProgramCU.h
3 // Author: Changchang Wu
4 // Description : interface for the ProgramCU classes.
5 // It is basically a wrapper around all the CUDA kernels
6 //
7 // Copyright (c) 2007 University of North Carolina at Chapel Hill
8 // All Rights Reserved
9 //
10 // Permission to use, copy, modify and distribute this software and its
11 // documentation for educational, research and non-profit purposes, without
12 // fee, and without a written agreement is hereby granted, provided that the
13 // above copyright notice and the following paragraph appear in all copies.
14 //
15 // The University of North Carolina at Chapel Hill make no representations
16 // about the suitability of this software for any purpose. It is provided
17 // 'as is' without express or implied warranty.
18 //
19 // Please send BUG REPORTS to ccwu@cs.unc.edu
20 //
22 
23 #ifndef _PROGRAM_CU_H
24 #define _PROGRAM_CU_H
25 #if defined(SIFTGPU_CUDA_ENABLED)
26 
27 class CuTexImage;
28 
29 class ProgramCU
30 {
31 public:
32  //GPU FUNCTIONS
33  static void FinishCUDA();
34  static int CheckErrorCUDA(const char* location);
35  static int CheckCudaDevice(int device);
36 public:
38  static void CreateFilterKernel(float sigma, float* kernel, int& width);
39  template<int KWIDTH> static void FilterImage(CuTexImage *dst, CuTexImage *src, CuTexImage* buf);
40  static void FilterImage(CuTexImage *dst, CuTexImage *src, CuTexImage* buf, float sigma);
41  static void ComputeDOG(CuTexImage* gus, CuTexImage* dog, CuTexImage* got);
42  static void ComputeKEY(CuTexImage* dog, CuTexImage* key, float Tdog, float Tedge);
43  static void InitHistogram(CuTexImage* key, CuTexImage* hist);
44  static void ReduceHistogram(CuTexImage*hist1, CuTexImage* hist2);
45  static void GenerateList(CuTexImage* list, CuTexImage* hist);
46  static void ComputeOrientation(CuTexImage*list, CuTexImage* got, CuTexImage*key,
47  float sigma, float sigma_step, int existing_keypoint);
48  static void ComputeDescriptor(CuTexImage*list, CuTexImage* got, CuTexImage* dtex, int rect = 0, int stream = 0);
49 
50  //data conversion
51  static void SampleImageU(CuTexImage *dst, CuTexImage *src, int log_scale);
52  static void SampleImageD(CuTexImage *dst, CuTexImage *src, int log_scale = 1);
53  static void ReduceToSingleChannel(CuTexImage* dst, CuTexImage* src, int convert_rgb);
54  static void ConvertByteToFloat(CuTexImage*src, CuTexImage* dst);
55 
56  //visualization
57  static void DisplayConvertDOG(CuTexImage* dog, CuTexImage* out);
58  static void DisplayConvertGRD(CuTexImage* got, CuTexImage* out);
59  static void DisplayConvertKEY(CuTexImage* key, CuTexImage* dog, CuTexImage* out);
60  static void DisplayKeyPoint(CuTexImage* ftex, CuTexImage* out);
61  static void DisplayKeyBox(CuTexImage* ftex, CuTexImage* out);
62 
63  //SIFTMATCH FUNCTIONS
64  static void MultiplyDescriptor(CuTexImage* tex1, CuTexImage* tex2, CuTexImage* texDot, CuTexImage* texCRT);
65  static void MultiplyDescriptorG(CuTexImage* texDes1, CuTexImage* texDes2,
66  CuTexImage* texLoc1, CuTexImage* texLoc2, CuTexImage* texDot, CuTexImage* texCRT,
67  float* H, float hdistmax, float* F, float fdistmax);
68  static void GetRowMatch(CuTexImage* texDot, CuTexImage* texMatch, float distmax, float ratiomax);
69  static void GetColMatch(CuTexImage* texCRT, CuTexImage* texMatch, float distmax, float ratiomax);
70 };
71 
72 #endif
73 #endif
74 
int width
int CheckErrorCUDA(const char *location)
Definition: lsd.c:1170