-
Notifications
You must be signed in to change notification settings - Fork 0
/
various.h
59 lines (52 loc) · 2.95 KB
/
various.h
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
#pragma once
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/imgproc/imgproc.hpp"
#include <string>
#include <sstream>
#include <utility>
#include <vector>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <float.h>
#include <map>
typedef unsigned int NxU32;
typedef int NxI32;
typedef float REAL;
const REAL BF_PI = 3.1415926535897932384626433832795028841971693993751f;
const REAL BF_DEG_TO_RAD = ((2.0f * BF_PI) / 360.0f);
const REAL BF_RAD_TO_DEG = (360.0f / (2.0f * BF_PI));
class various{
public:
template <typename T> static std::string ToString(T input);
template <typename T> static double ToDouble(T input);
/* OUTPUTS VECTOR CONTENTS TO A FILE */
static void iterateVectorToFile(std::vector<std::pair<double, double>> vectorInput, std::string fileName);
static std::string fileNameErase(std::string fileName);
/* LOAD CALIBRATION DATA */
static std::map<int, std::vector<std::pair<double,double>>> getThicknessDataFound(std::map<int, std::vector<std::pair<double,double>>> rawData,
const int i, const std::string filTar, const int kV);
/* MARK THE PIXELS OF INTEREST OF THE THICKNESS MAP */
static void redMap(cv::Mat tg, const std::vector<std::pair<int,int>> inputVec);
static void bf_getTranslation(const REAL *matrix,REAL *t);
static void bf_matrixToQuat(const REAL *matrix,REAL *quat);
static void bf_matrixMultiply(const REAL *pA,const REAL *pB,REAL *pM);
static void bf_eulerToQuat(REAL roll,REAL pitch,REAL yaw,REAL *quat);
static void bf_eulerToQuat(const REAL *euler,REAL *quat);
static void bf_setTranslation(const REAL *translation,REAL *matrix);
static void bf_transform(const REAL matrix[16],const REAL v[3],REAL t[3]);
static REAL bf_dot(const REAL *p1,const REAL *p2);
static void bf_cross(REAL *cross,const REAL *a,const REAL *b);
static void bf_quatToMatrix(const REAL *quat,REAL *matrix);
static void bf_rotationArc(const REAL *v0,const REAL *v1,REAL *quat);
static void bf_planeToMatrix(const REAL *plane,REAL *matrix);
static void bf_inverseRT(const REAL matrix[16],const REAL pos[3],REAL t[3]);
static void bf_rotate(const REAL matrix[16],const REAL v[3],REAL t[3]);
static void bf_computeOBB(NxU32 vcount,const REAL *points,NxU32 pstride,REAL *sides,REAL *matrix);
static bool bf_computeBestFitPlane(NxU32 vcount, const REAL *points, NxU32 vstride, const REAL *weights, NxU32 wstride, REAL *plane);
static void bf_computeBestFitOBB(NxU32 vcount,const REAL *points,NxU32 pstride,REAL *sides,REAL *matrix,bool bruteForce);
static void bf_computeBestFitOBB(NxU32 vcount,const REAL *points,NxU32 pstride,REAL *sides,REAL *pos,REAL *quat,bool bruteForce);
};