forked from YoYo000/fusibile
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Silvano Galliani
committed
Nov 26, 2015
1 parent
d2a36fb
commit 94d0222
Showing
25 changed files
with
5,450 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
cmake_minimum_required (VERSION 2.8) | ||
project (fusibile) | ||
|
||
find_package(OpenCV REQUIRED ) | ||
#find_package(Armadillo REQUIRED) | ||
find_package(CUDA 6.0 REQUIRED ) # For Cuda Managed Memory and c++11 | ||
|
||
include_directories(${OpenCV_INCLUDE_DIRS}) | ||
include_directories(.) | ||
|
||
#set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-O3 --use_fast_math --ptxas-options=-v -std=c++11 --compiler-options -Wall -gencode arch=compute_30,code=sm_30 -gencode arch=compute_52,code=sm_52) | ||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-O3 --use_fast_math --ptxas-options=-v -std=c++11 --compiler-options -Wall -gencode arch=compute_52,code=sm_52) | ||
|
||
if(CMAKE_COMPILER_IS_GNUCXX) | ||
add_definitions(-std=c++11) | ||
#add_definitions(-march=native) | ||
endif() | ||
|
||
find_package(OpenMP) | ||
if (OPENMP_FOUND) | ||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") | ||
endif() | ||
|
||
# for YouCompleteMe | ||
set( CMAKE_EXPORT_COMPILE_COMMANDS 1 ) | ||
|
||
# For compilation ... | ||
# Specify target & source files to compile it from | ||
cuda_add_executable( | ||
fusibile | ||
cameraGeometryUtils.h | ||
vector_operations.h | ||
camera.h | ||
globalstate.h | ||
algorithmparameters.h | ||
cameraparameters.h | ||
linestate.h | ||
groundTruthUtils.h | ||
displayUtils.h | ||
mathUtils.h | ||
fileIoUtils.h | ||
fusibile.cu | ||
main.cpp | ||
) | ||
|
||
# For linking ... | ||
# Specify target & libraries to link it with | ||
target_link_libraries(fusibile | ||
${OpenCV_LIBS} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
#pragma once | ||
#include "managed.h" | ||
|
||
//cost function | ||
enum { PM_COST = 0, CENSUS_TRANSFORM = 1, ADAPTIVE_CENSUS = 2, CENSUS_SELFSIMILARITY = 3, PM_SELFSIMILARITY = 4, ADCENSUS = 5, ADCENSUS_SELFSIMILARITY = 6, SPARSE_CENSUS = 7 }; | ||
|
||
//cost combination | ||
enum { COMB_ALL = 0, COMB_BEST_N = 1, COMB_ANGLE = 2, COMB_GOOD = 3}; | ||
|
||
|
||
class AlgorithmParameters : public Managed{ | ||
public: | ||
int algorithm; // algorithm cost type | ||
float max_disparity; // maximal disparity value CUDA | ||
float min_disparity; // minimum disparity value (default 0) CUDA | ||
int box_hsize; // filter kernel width CUDA | ||
int box_vsize; // filter kernel height CUDA | ||
float tau_color; // PM_COST max. threshold for color CUDA | ||
float tau_gradient; // PM_COST max. threshold for gradient CUDA | ||
float alpha; // PM_COST weighting between color and gradient CUDA | ||
float gamma; // parameter for weight function (used e.g. in PM_COST) CUDA | ||
int border_value; // what value should pixel at extended border get (constant or replicate -1) | ||
int iterations; // number of iterations | ||
bool color_processing; // use color processing or not (otherwise just grayscale processing) | ||
float dispTol; //PM Stereo: 1, PM Huber: 0.5 | ||
float normTol; // 0.1 ... about 5.7 degrees | ||
float census_epsilon; //for census transform | ||
int self_similarity_n; // number of pixels considered for self similarity | ||
float cam_scale; //used to rescale K in case of rescaled image size | ||
int num_img_processed; //number of images that are processed as reference images | ||
float costThresh; // threshold to decide whether disparity/depth is valid or not | ||
float good_factor; // for cost aggregation/combination good: factor for truncation CUDA | ||
int n_best; // CUDA | ||
int cost_comb; // CUDA | ||
bool viewSelection; | ||
float depthMin; // CUDA | ||
float depthMax; // CUDA | ||
// hack XXX | ||
int cols; | ||
int rows; | ||
// fuse | ||
bool storePlyFiles; | ||
bool gt_compare; | ||
bool gt_normal_compare; | ||
|
||
//threshold for consistency check | ||
float depthThresh; | ||
float normalThresh ; | ||
|
||
//how many views need to be consistent? (for update: numConsistentThresh+1) | ||
int numConsistentThresh; | ||
bool saveTexture; | ||
|
||
AlgorithmParameters(){ | ||
algorithm = 0; // algorithm cost type | ||
max_disparity = 256.0f; // maximal disparity value CUDA | ||
min_disparity = 0.0f; // minimum disparity value (default 0) CUDA | ||
box_hsize = 15; // filter kernel width CUDA | ||
box_vsize = 15; // filter kernel height CUDA | ||
tau_color = 10; // PM_COST max. threshold for color CUDA | ||
tau_gradient = 2.0f; // PM_COST max. threshold for gradient CUDA | ||
alpha = 0.9f; // PM_COST weighting between color and gradient CUDA | ||
gamma = 10.0f; // parameter for weight function (used e.g. in PM_COST) CUDA | ||
border_value = -1; // what value should pixel at extended border get (constant or replicate -1) | ||
iterations = 8; // number of iterations | ||
color_processing = false; // use color processing or not (otherwise just grayscale processing) | ||
dispTol = 1.0; //PM Stereo: 1, PM Huber: 0.5 | ||
normTol = 0.1f; // 0.1 ... about 5.7 degrees | ||
census_epsilon = 2.5f; //for census transform | ||
self_similarity_n = 50; // number of pixels considered for self similarity | ||
cam_scale = 1.0f; //used to rescale K in case of rescaled image size | ||
num_img_processed = 1; //number of images that are processed as reference images | ||
costThresh = 40.0f; // threshold to decide whether disparity/depth is valid or not | ||
good_factor = 1.5f; // for cost aggregation/combination good: factor for truncation CUDA | ||
n_best = 2; // CUDA | ||
cost_comb = 1; // CUDA | ||
viewSelection = false; | ||
depthMin = 2.0f; // CUDA | ||
depthMax = 20.0f; // CUDA | ||
|
||
storePlyFiles = true; | ||
gt_compare = false; | ||
gt_normal_compare = false; | ||
|
||
//threshold for consistency check | ||
depthThresh = 0.5f; | ||
normalThresh = 0.52f; | ||
|
||
//how many views need to be consistent? (for update: numConsistentThresh+1) | ||
numConsistentThresh = 2; | ||
saveTexture = true; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#pragma once | ||
#include "managed.h" | ||
#include <vector_types.h> | ||
|
||
class Camera_cu : public Managed { | ||
public: | ||
float* P; | ||
/*float* P_col3;*/ | ||
float4 P_col34; | ||
float* P_inv; | ||
float* M_inv; | ||
float* R; | ||
/*float* t;*/ | ||
float4 t4; | ||
/*float* C;*/ | ||
float4 C4; | ||
float fx; | ||
float fy; | ||
float f; | ||
float alpha; | ||
float baseline; | ||
bool reference; | ||
float depthMin; //this could be figured out from the bounding volume (not done right now, but that's why this parameter is here as well and not only in AlgorithmParameters) | ||
float depthMax; //this could be figured out from the bounding volume (not done right now, but that's why this parameter is here as well and not only in AlgorithmParameters) | ||
//int id; //corresponds to the image name id (eg. 0-10), independent of order in argument list, just dependent on name | ||
char* id; | ||
float* K; | ||
float* K_inv; | ||
Camera_cu() | ||
{ | ||
baseline = 0.54f; | ||
reference = false; | ||
depthMin = 2.0f; //this could be figured out from the bounding volume (not done right now, but that's why this parameter is here as well and not only in AlgorithmParameters) | ||
depthMax = 20.0f; | ||
cudaMallocManaged (&P, sizeof(float) * 4 * 4); | ||
cudaMallocManaged (&P_inv, sizeof(float) * 4 * 4); | ||
cudaMallocManaged (&M_inv, sizeof(float) * 4 * 4); | ||
cudaMallocManaged (&K, sizeof(float) * 4 * 4); | ||
cudaMallocManaged (&K_inv, sizeof(float) * 4 * 4); | ||
cudaMallocManaged (&R, sizeof(float) * 4 * 4); | ||
} | ||
~Camera_cu() | ||
{ | ||
cudaFree (P); | ||
cudaFree (P_inv); | ||
cudaFree (M_inv); | ||
cudaFree (K); | ||
cudaFree (K_inv); | ||
cudaFree (R); | ||
} | ||
|
||
}; |
Oops, something went wrong.