|
| 1 | + |
| 2 | +//#define DP_NO_LOG |
| 3 | +#define ASSESSMENT |
| 4 | + |
| 5 | + |
| 6 | +#ifndef __UglyMan_Stitiching__Configure__ |
| 7 | +#define __UglyMan_Stitiching__Configure__ |
| 8 | + |
| 9 | +#include "./Debugger/ErrorController.h" |
| 10 | +#include "./Debugger/TimeCalculator.h" |
| 11 | + |
| 12 | +#include <iostream> |
| 13 | +#include <fstream> |
| 14 | +#include <vector> |
| 15 | +#include <string> |
| 16 | +#include <set> |
| 17 | +#include "dirent.h" // NOTE: you may have to add dirent.h in project files and change <dirent.h> to "dirent.h". search for this .h file on internet |
| 18 | +#include <algorithm> |
| 19 | +#include <direct.h> |
| 20 | +using namespace std; |
| 21 | + |
| 22 | + |
| 23 | +#define _USE_MATH_DEFINES |
| 24 | +#include <cmath> |
| 25 | + |
| 26 | +#include "opencv2/core/core.hpp" |
| 27 | +#include "opencv2/highgui/highgui.hpp" |
| 28 | +#include "opencv2/imgproc/imgproc.hpp" |
| 29 | +using namespace cv; |
| 30 | +#include "opencv2/ximgproc.hpp" |
| 31 | + |
| 32 | + |
| 33 | +#include <Eigen/SVD> |
| 34 | +#include <Eigen/IterativeLinearSolvers> |
| 35 | +#include <Eigen/Sparse> |
| 36 | +#include <unsupported/Eigen/SparseExtra> |
| 37 | +#include "opencv2/dnn.hpp" |
| 38 | +#include <opencv2/dnn/layer.details.hpp> |
| 39 | +using namespace Eigen; |
| 40 | + |
| 41 | +#include "vl/sift.h" |
| 42 | +using namespace cv::dnn; |
| 43 | + |
| 44 | + |
| 45 | +/******************************/ |
| 46 | +/******* you may adjust *******/ |
| 47 | +/******************************/ |
| 48 | + |
| 49 | +const int RUN_TYPE = 2; //0:GSP 1:GES-GSP 2: Our GES-GSP + SAM |
| 50 | +const string TXT_NAME = "-STITCH-GRAPH.txt"; |
| 51 | + |
| 52 | + |
| 53 | +/*** data setting ***/ |
| 54 | +const int GRID_SIZE = 40; |
| 55 | +const int DOWN_SAMPLE_IMAGE_SIZE = 800 * 600; |
| 56 | +//Contour length/image shortest edge ratio |
| 57 | +const double CONTENT_LENGTH_THRESHOLD = 0.15; |
| 58 | + |
| 59 | +//HED threshold |
| 60 | +const double HED_THRESHOLD = 0.5; |
| 61 | +const int threshold_value = 120; |
| 62 | + |
| 63 | +/*** APAP ***/ |
| 64 | +const double APAP_GAMMA = 0.0015; |
| 65 | +const double APAP_SIGMA = 8.5; |
| 66 | + |
| 67 | +/*** matching method ***/ |
| 68 | +const string FEATURE_RATIO_TEST_THRESHOLD_STRING = "15e-1";//15*10^-1=1.5 |
| 69 | +const double FEATURE_RATIO_TEST_THRESHOLD = atof(FEATURE_RATIO_TEST_THRESHOLD_STRING.c_str()); |
| 70 | + |
| 71 | +/*** homography based ***/ |
| 72 | +const double GLOBAL_HOMOGRAPHY_MAX_INLIERS_DIST = 5.; |
| 73 | +const double LOCAL_HOMOGRAPHY_MAX_INLIERS_DIST = 3.; |
| 74 | +const int LOCAL_HOMOGRAPHY_MIN_FEATURES_COUNT = 40; |
| 75 | + |
| 76 | +/*** vlfeat sift ***/ |
| 77 | +const int SIFT_LEVEL_COUNT = 3; |
| 78 | +const int SIFT_MINIMUM_OCTAVE_INDEX = 0; |
| 79 | +const double SIFT_PEAK_THRESH = 0.; |
| 80 | +const double SIFT_EDGE_THRESH = 10.; |
| 81 | + |
| 82 | +/*** init feature ***/ |
| 83 | +const double INLIER_TOLERANT_STD_DISTANCE = 4.25; /* mean + 4.25 * std */ |
| 84 | + |
| 85 | +/*** sRANSAC ***/ |
| 86 | +const double GLOBAL_TRUE_PROBABILITY = 0.225; |
| 87 | +const double LOCAL_TRUE_PROBABILITY = 0.2; |
| 88 | +const double OPENCV_DEFAULT_CONFIDENCE = 0.995; |
| 89 | + |
| 90 | +/*** sparse linear system ***/ |
| 91 | +const double STRONG_CONSTRAINT = 1e4; |
| 92 | + |
| 93 | +/*** bundle adjustment ***/ |
| 94 | +const int CRITERIA_MAX_COUNT = 1000; |
| 95 | +const double CRITERIA_EPSILON = DBL_EPSILON; |
| 96 | + |
| 97 | +/*** 2D Method ***/ |
| 98 | +const double TOLERANT_ANGLE = 1.5; |
| 99 | + |
| 100 | +/*** 3D Method ***/ |
| 101 | +const double LAMBDA_GAMMA = 10; |
| 102 | + |
| 103 | +/******************************/ |
| 104 | +/******************************/ |
| 105 | +/******************************/ |
| 106 | + |
| 107 | +/*** rotation method setting ***/ |
| 108 | +enum GLOBAL_ROTATION_METHODS { |
| 109 | + GLOBAL_ROTATION_2D_METHOD = 0, GLOBAL_ROTATION_3D_METHOD, GLOBAL_ROTATION_METHODS_SIZE |
| 110 | +}; |
| 111 | +const string GLOBAL_ROTATION_METHODS_NAME[GLOBAL_ROTATION_METHODS_SIZE] = { |
| 112 | + "[2D]", "[3D]" |
| 113 | +}; |
| 114 | + |
| 115 | +/* blending method setting */ |
| 116 | +enum BLENDING_METHODS { |
| 117 | + BLEND_AVERAGE = 0, BLEND_LINEAR, BLEND_METHODS_SIZE |
| 118 | +}; |
| 119 | +const string BLENDING_METHODS_NAME[BLEND_METHODS_SIZE] = { |
| 120 | + "[BLEND_AVERAGE]", "[BLEND_LINEAR]" |
| 121 | +}; |
| 122 | + |
| 123 | + |
| 124 | +/* type */ |
| 125 | +typedef float FLOAT_TYPE; |
| 126 | +typedef Size_<FLOAT_TYPE> Size2; |
| 127 | +typedef Point_<FLOAT_TYPE> Point2; |
| 128 | +typedef Rect_<FLOAT_TYPE> Rect2; |
| 129 | + |
| 130 | +const int DIMENSION_2D = 2; |
| 131 | +const int HOMOGRAPHY_VARIABLES_COUNT = 9; |
| 132 | + |
| 133 | +/* AutoStitch */ |
| 134 | +enum AUTO_STITCH_WAVE_CORRECTS { WAVE_X = 0, WAVE_H, WAVE_V }; |
| 135 | +const AUTO_STITCH_WAVE_CORRECTS WAVE_CORRECT = WAVE_H; |
| 136 | +const string AUTO_STITCH_WAVE_CORRECTS_NAME[] = { "", "[WAVE_H]", "[WAVE_V]" }; |
| 137 | + |
| 138 | +#endif /* defined(__UglyMan_Stitiching__Configure__) */ |
0 commit comments