-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcuda_class.cuh
90 lines (68 loc) · 2.54 KB
/
cuda_class.cuh
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
#ifndef CUDA_CLASS_CUH
#define CUDA_CLASS_CUH
#include <opencv2/core/core.hpp>
#include "cuda_pyramid.cuh"
#include "cuda_solver.cuh"
#include "defines.hpp"
#include "domains.hpp"
#include "enums.hpp"
#include "model_class.hpp"
#include <assert.h>
#include <iostream>
#include <math.h> //for fmaxf, fminf
#include <stdio.h>
#include <string>
// multithread includes
#include <future>
#include <thread>
// Test loading all images at once
#include <queue>
class CudaClass {
cudaStream_t correlationStream = nullptr;
float *pinnedChi, *lastGoodChi;
cudaPyramid cudaPyramidManager;
cudaSolver cudaSolverManager{cudaPyramidManager};
int deviceCount = 0;
int devicesAvailable = 0;
bool initialize_devices = true;
int number_of_colors;
interpolationModelEnum interpolationModel;
fittingModelEnum fittingModel;
int number_of_model_parameters;
float maximum_iterations;
float required_precision;
public:
CudaClass();
~CudaClass();
int initialize();
void set_deviceCount(int deviceCount_in);
void set_max_iters(int maximum_iterations_);
void set_precision(float required_precision_);
void resetNextPyramid(const std::string nxtPath);
void set_fitting_model(fittingModelEnum fittingModel_in);
void set_interpolation_model(interpolationModelEnum interpolationModel_in);
void resetImagePyramids(const std::string undPath, const std::string defPath,
const std::string nxtPath, colorEnum color_mode,
const int start, const int step, const int stop);
errorEnum resetPolygon(int iSector, int x0, int y0, int x1, int y1);
errorEnum resetPolygon(int iSector, float r, float dr, float a, float da,
float cx, float cy, int as);
errorEnum resetPolygon(v_points blobContour);
void updatePolygon(int iSector,
deformationDescriptionEnum deformationDescription);
void makeUndPyramidFromDef();
void makeDefPyramidFromNxt();
CorrelationResult *correlate(int iSector, float *initial_guess_,
frame_results &results);
v_points getUndXY0ToCPU(int iSector);
v_points getDefXY0ToCPU(int iSector);
std::queue<cv::Mat> tempQ;
private:
errorEnum NewtonRaphsonStep(int iSector, int pyramidLevel,
parameterTypeEnum parSrc, float lambda);
errorEnum findNewParameters(int iSector, int pyramidLevel,
parameterTypeEnum parSrc,
parameterTypeEnum parDst, float *chi,
float lambda);
};
#endif // CUDA_CLASS_CUH