-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathCameraTracking.h
More file actions
61 lines (50 loc) · 1.55 KB
/
Copy pathCameraTracking.h
File metadata and controls
61 lines (50 loc) · 1.55 KB
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
#ifndef CAMERA_TRACKING_H
#define CAMERA_TRACKING_H
#define GLM_ENABLE_EXPERIMENTAL
#define GLM_FORCE_CUDA
#define GLM_SWIZZLE
#if defined(_WIN32)
#include <Windows.h>
#endif
#include <cuda_runtime_api.h>
//#include <thrust/device_vector.h>
//#include <thrust/device_ptr.h>
//This is a simple vector library. Use this with CUDA instead of GLM.
#include "cuda_helper/cuda_SimpleMatrixUtil.h"
//#include "LinearSystem.h"
#include "Solver.h"
#include "EigenUtil.h"
//__align__(16)
//struct CorrPair {
// float3 src = make_float3(0);
// float3 targ = make_float3(0);
// float3 targNormal = make_float3(0);
// float distance = 0; //between two correspondences
// int dummy = -2; //padding
//};
//using thrust::device_vector;
//using thrust::device_ptr;
class CameraTracking {
private:
int width, height;
//LinearSystem linearSystem;
Solver solver;
int maxIters = 20;
float4* d_correspondenceNormals;
float4* d_correspondences;
float* d_residuals;
//thrust::device_vector<CorrPair> d_coordPair;
//device_vector<float4> d_correspondences;
//device_vector<float4> d_correspondenceNormals;
//device_vector<float> d_residuals;
Matrix4x4f deltaTransform;
float globalCorrespondenceError = 0.0f;
Matrix4x4f delinearizeTransformation(const Vector6f & sol);
Eigen::Matrix4f rigidAlignment(const float4*, const float4*, const Eigen::Matrix4f&);
public:
CameraTracking(int, int);
~CameraTracking();
void Align(float4*, float4*, float4*, float4*, const uint16_t*, const uint16_t*);
Matrix4x4f getTransform() { return deltaTransform; }
};
#endif