Go to the documentation of this file.00001
00005 #ifndef _THERMALVIS_TOOLS_H_
00006 #define _THERMALVIS_TOOLS_H_
00007
00008
00009
00010 #include <stdio.h>
00011 #include <unistd.h>
00012 #include <getopt.h>
00013 #include <iostream>
00014 #include <fstream>
00015 #include <sys/stat.h>
00016 #include <dirent.h>
00017 #include <sstream>
00018 #include <string>
00019 #include <string.h>
00020 #include <assert.h>
00021 #include <fcntl.h>
00022 #include <unistd.h>
00023 #include <errno.h>
00024 #include <malloc.h>
00025 #include <sys/stat.h>
00026 #include <sys/types.h>
00027 #include <sys/time.h>
00028 #include <sys/mman.h>
00029 #include <sys/ioctl.h>
00030
00031
00032
00033 #include <cstdlib>
00034 #include <stdio.h>
00035
00036 #include <cmath>
00037 #include <iostream>
00038 #include <fstream>
00039 #include <limits.h>
00040
00041 #ifndef _WIN32
00042
00043 #include <unistd.h>
00044 #include <getopt.h>
00045
00046
00047 #include <sys/stat.h>
00048 #include <dirent.h>
00049 #endif
00050
00051 #include <stdio.h>
00052 #include <termios.h>
00053 #include <unistd.h>
00054 #include <sys/types.h>
00055 #include <sys/time.h>
00056
00057
00058 #include "sys/time.h"
00059
00060 #include "opencv2/calib3d/calib3d.hpp"
00061 #include "opencv2/imgproc/imgproc.hpp"
00062 #include "opencv2/highgui/highgui.hpp"
00063 #include "opencv2/features2d/features2d.hpp"
00064 #include "opencv2/gpu/gpu.hpp"
00065 #include <opencv2/video/video.hpp>
00066
00067 #define USE_CLAHE 0
00068
00069 using namespace std;
00070
00071
00072 typedef std::pair<unsigned int,unsigned int> mypair;
00073 bool comparator ( const mypair& l, const mypair& r);
00074
00076 int countElementsInFolder(const char* folderName, vector<string>& elementNames, int elementType);
00077
00078 void convertUcharToBinary(unsigned char val, int* binaryArray);
00079
00080 double lookupValue(double xi, double yi, double maxVal, const cv::Mat& lookupMat);
00081
00082 double getInterpolatedVal(const cv::Mat& img, cv::Point2f& coord);
00083
00085 double distBetweenPts(cv::Point3d& P1, cv::Point3d& P2);
00086
00088 void calcParameters(const vector<double>& v, double& mean, double& stdev);
00089
00091 double calcLinePerpDistance(double *line1, double *line2);
00092
00093 void findLinearModel(double* x, double* y, int termsToConsider, double &m, double &c);
00094
00096 double timeElapsedMS(struct timeval& timer, bool reset = true);
00097
00098 bool matricesAreEqual(cv::Mat& mat1, cv::Mat& mat2);
00099 cv::Scalar getRandomColour();
00100
00101 void addUniqueToVector(vector<unsigned int>& dst, vector<unsigned int>& src);
00102
00103 double asymmetricGaussianValue(double score, double mean, double loVar, double hiVar);
00104
00105 void randomSelection(vector<unsigned int>& src, vector<unsigned int>& dst, unsigned int max);
00106
00108 double perpDist(cv::Point2f& P1, cv::Point2f& P2, cv::Point2f& P3);
00109
00111 void redistortPoints(const vector<cv::Point2f>& src, vector<cv::Point2f>& dst, const cv::Mat& cameraMatrix, const cv::Mat& distCoeffs, const cv::Mat& newCamMat=cv::Mat::eye(3,3,CV_64FC1));
00112
00114 long long int factorial(int num);
00115
00117 double distBetweenPts(cv::Point& P1, cv::Point& P2);
00119 double distBetweenPts2f(cv::Point2f& P1, cv::Point2f& P2);
00120
00122 void getNextCombo(vector<unsigned int>& currentIndices, int r, int n);
00123
00125 double findEquivalentProbabilityScore(double* values, int quantity, double prob);
00126
00127 void readPoints(const char *filename, vector<cv::Point2f>& pts);
00128 void writePoints(const char *filename, const vector<cv::Point2f>& pts);
00129
00131 void convert_byte_to_binary_string(void* src, char* dst);
00132
00134 cv::Point2f meanPoint(cv::Point2f& P1, cv::Point2f& P2);
00135
00137 double findMinimumSeparation(vector<cv::Point2f>& pts);
00138
00139 #endif