Skip to content

Commit

Permalink
warning fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Silvano Galliani committed Jan 8, 2016
1 parent 49fe651 commit 84a1825
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 56 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-O3 --use_fast_math --ptxas-options=-v -s

if(CMAKE_COMPILER_IS_GNUCXX)
add_definitions(-std=c++11)
add_definitions(-Wall)
add_definitions(-Wextra)
add_definitions(-pedantic)
add_definitions(-Wno-unused-function)
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -ffast-math -march=native") # extend release-profile with fast-math
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall") # extend debug-profile with -Wall
#add_definitions(-march=native)
endif()

Expand Down
9 changes: 4 additions & 5 deletions cameraGeometryUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ inline Vec3f get3Dpoint ( Camera &cam, int x, int y, float depth ){
}

// get the viewing ray for a pixel position of the camera
static inline Vec3f getViewVector ( Camera &cam, int x, int y, bool rectified ) {
static inline Vec3f getViewVector ( Camera &cam, int x, int y) {

//get some point on the line (the other point on the line is the camera center)
Vec3f ptX = get3Dpoint ( cam,x,y,1.0f );
Expand All @@ -79,7 +79,7 @@ float inline getPlaneDistance ( Vec3f &normal, Vec3f &X ) {
return -(normal.dot(X));
}

static float getD ( Vec3f &normal, int x0, int y0, float depth, bool rectified, Camera &cam ) {
static float getD ( Vec3f &normal, int x0, int y0, float depth, Camera &cam ) {
Vec3f pt;
{
pt = get3Dpoint ( cam, (float)x0, (float)y0, depth );
Expand Down Expand Up @@ -295,7 +295,6 @@ CameraParameters getCameraParameters ( CameraParameters_cu &cpc, InputFiles inpu
numCameras = inputFiles.img_filenames.size ();
params.cameras.resize ( numCameras );
/*cout << "Num Cameras " << numCameras << endl;*/
size_t numImages = inputFiles.img_filenames.size ();
readKRtFileMiddlebury ( inputFiles.krt_file, params.cameras, inputFiles);
for ( size_t i = 0; i < numCameras; i++ ) {
unsigned found = inputFiles.img_filenames[i].find_last_of ( "." );
Expand All @@ -316,7 +315,7 @@ CameraParameters getCameraParameters ( CameraParameters_cu &cpc, InputFiles inpu
vector<Mat_<float> > C ( numCameras );
vector<Mat_<float> > t ( numCameras );

for ( int i = 0; i < numCameras; i++ ) {
for ( size_t i = 0; i < numCameras; i++ ) {
decomposeProjectionMatrix ( params.cameras[i].P,K[i],R[i],T[i] );

/*cout << "K: " << K[i] << endl;*/
Expand Down Expand Up @@ -351,7 +350,7 @@ CameraParameters getCameraParameters ( CameraParameters_cu &cpc, InputFiles inpu
// get focal length from calibration matrix
params.f = params.K ( 0,0 );

for ( int i = 0; i < numCameras; i++ ) {
for ( size_t i = 0; i < numCameras; i++ ) {
params.cameras[i].K = scaleK(K[i],scaleFactor);
params.cameras[i].K_inv = params.cameras[i].K.inv ( );
//params.cameras[i].f = params.cameras[i].K(0,0);
Expand Down
26 changes: 13 additions & 13 deletions displayUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Mat correctGamma( Mat& img, double gamma ) {
LUT( img, lut_matrix, result );

return result;
};
}


static void getDisparityForDisplay(const Mat_<float> &disp, Mat &dispGray, Mat &dispColor, float numDisparities, float minDisp = 0.0f){
Expand All @@ -47,7 +47,7 @@ static void getDisparityForDisplay(const Mat_<float> &disp, Mat &dispGray, Mat &
dispColor.at<Vec3b>(y,x) = Vec3b(0,0,0);
}
}
};
}

static void convertDisparityDepthImage(const Mat_<float> &dispL, Mat_<float> &d, float f, float baseline){
d = Mat::zeros(dispL.rows, dispL.cols, CV_32F);
Expand All @@ -56,7 +56,7 @@ static void convertDisparityDepthImage(const Mat_<float> &dispL, Mat_<float> &d,
d(y,x) = disparityDepthConversion(f,baseline,dispL(y,x));
}
}
};
}

static string getColorString(uint8_t color){
stringstream ss;
Expand All @@ -76,7 +76,7 @@ static string getColorString(Vec3i color){
ss << (int)((float)color(2)/256.f) << " " << (int)((float)color(1)/256.f) << " " << (int)((float)color(0)/256.f);
return ss.str();
}
static void storePlyFileBinaryPointCloud (char* plyFilePath, PointCloudList &pc, Camera cam, Mat_<float> &distImg) {
static void storePlyFileBinaryPointCloud (char* plyFilePath, PointCloudList &pc, Mat_<float> &distImg) {
cout << "store 3D points to ply file" << endl;

FILE *outputPly;
Expand All @@ -101,7 +101,7 @@ static void storePlyFileBinaryPointCloud (char* plyFilePath, PointCloudList &pc,

//write data
#pragma omp parallel for
for(int i = 0; i < pc.size; i++) {
for(size_t i = 0; i < pc.size; i++) {
const Point_li &p = pc.points[i];
const float4 normal = p.normal;
float4 X = p.coord;
Expand Down Expand Up @@ -131,15 +131,15 @@ static void storePlyFileBinaryPointCloud (char* plyFilePath, PointCloudList &pc,
}
fclose(outputPly);
}
static void storeXYZPointCloud (char* plyFilePath, PointCloudList &pc, Camera cam, Mat_<float> &distImg) {
static void storeXYZPointCloud (char* plyFilePath, PointCloudList &pc) {
cout << "store 3D points to ply file" << endl;

ofstream myfile;
myfile.open (plyFilePath, ios::out);

//write data
#pragma omp parallel for
for(int i = 0; i < pc.size; i++) {
for(size_t i = 0; i < pc.size; i++) {
const Point_li &p = pc.points[i];
const float4 normal = p.normal;
float4 X = p.coord;
Expand All @@ -157,7 +157,7 @@ static void storeXYZPointCloud (char* plyFilePath, PointCloudList &pc, Camera ca
}
myfile.close();
}
static void storePlyFileAsciiPointCloud (char* plyFilePath, PointCloudList &pc, Camera cam, Mat_<float> &distImg) {
static void storePlyFileAsciiPointCloud (char* plyFilePath, PointCloudList &pc, Mat_<float> &distImg) {
cout << "store 3D points to ply file" << endl;

/*FILE *outputPly;*/
Expand Down Expand Up @@ -201,7 +201,7 @@ static void storePlyFileAsciiPointCloud (char* plyFilePath, PointCloudList &pc,

//write data
#pragma omp parallel for
for(int i = 0; i < pc.size; i++) {
for(size_t i = 0; i < pc.size; i++) {
const Point_li &p = pc.points[i];
const float4 normal = p.normal;
float4 X = p.coord;
Expand Down Expand Up @@ -233,7 +233,7 @@ static void storePlyFileAsciiPointCloud (char* plyFilePath, PointCloudList &pc,
/*fclose(outputPly);*/
}
//template <typename ImgType>
static void storePlyFileBinaryPointCloud(char* plyFilePath, PointCloud &pc, Camera cam, Mat_<float> &distImg) {
static void storePlyFileBinaryPointCloud(char* plyFilePath, PointCloud &pc, Mat_<float> &distImg) {
cout << "store 3D points to ply file" << endl;

FILE *outputPly;
Expand Down Expand Up @@ -261,11 +261,11 @@ static void storePlyFileBinaryPointCloud(char* plyFilePath, PointCloud &pc, Came
/*#pragma omp parallel for*/
for(int i = 0; i < pc.size; i++){
const Point_cu &p = pc.points[i];
const float4 normal = p.normal;
//const float4 normal = p.normal;
float4 X = p.coord;
/*printf("Writing point %f %f %f\n", X.x, X.y, X.z);*/
/*float color = p.texture;*/
const char color = 127.0f;
//const char color = 127.0f;

if(!(X.x < FLT_MAX && X.x > -FLT_MAX) || !(X.y < FLT_MAX && X.y > -FLT_MAX) || !(X.z < FLT_MAX && X.z >= -FLT_MAX)){
X.x = 0.0f;
Expand Down Expand Up @@ -442,4 +442,4 @@ static void getNormalsForDisplay(const Mat &normals, Mat &normals_display, int r
else
normals.convertTo(normals_display,CV_16U,32767,32767);
cvtColor(normals_display,normals_display,COLOR_RGB2BGR);
};
}
18 changes: 9 additions & 9 deletions fileIoUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ static void getProjectionMatrix(char* line, Mat_<float> &P){

idx++;
}
};
}

static int read3Dpoint(char* line, Vec3f &pt){
const char* p;
Expand Down Expand Up @@ -51,7 +51,7 @@ static void readCalibFileKitti(const string calib_filename, Mat_<float> &P1, Mat
myfile.getline(line,512);
getProjectionMatrix(line,P2);
myfile.close();
};
}

static void readBoundingVolume(const string filename, Vec3f &ptBL, Vec3f & ptTR){
ifstream myfile;
Expand All @@ -65,7 +65,7 @@ static void readBoundingVolume(const string filename, Vec3f &ptBL, Vec3f & ptTR)
read3Dpoint(line,ptTR);

myfile.close();
};
}


static void readCameraFileStrecha(const string camera_filename, float &focalLength){
Expand Down Expand Up @@ -136,7 +136,7 @@ static void readKRtFileMiddlebury(const string filename, vector<Camera> cameras,
/*cout << "t is " << vt << endl;*/
//cout << "Filename is " << tmp << endl;
//cout << "image Filename is " << inputFiles.img_filenames[i] << endl;
for( int j = 0; j < inputFiles.img_filenames.size(); j++) {
for( size_t j = 0; j < inputFiles.img_filenames.size(); j++) {
if( tmp == inputFiles.img_filenames[j]) {
truei=j;
break;
Expand Down Expand Up @@ -179,16 +179,16 @@ static void writeImageToFile(const char* outputFolder,const char* name,const Mat
char outputPath[256];
sprintf(outputPath, "%s/%s.png", outputFolder,name);
imwrite(outputPath,img);
};
}

static void writeParametersToFile(char* resultsFile, InputFiles inputFiles, AlgorithmParameters &algParameters, GTcheckParameters &gtParameters, uint32_t numPixels){
static void writeParametersToFile(char* resultsFile, InputFiles inputFiles, AlgorithmParameters &algParameters, uint32_t numPixels){

ofstream myfile;
myfile.open (resultsFile, ios::out);
myfile << "Number of images: " << inputFiles.img_filenames.size() << endl;
myfile << "Image folder: " << inputFiles.images_folder << endl;
myfile << "Images: ";
for(int i=0; i < inputFiles.img_filenames.size(); i++)
for(size_t i=0; i < inputFiles.img_filenames.size(); i++)
myfile << inputFiles.img_filenames[i] << ", " ;
myfile << endl;
if(numPixels != 0)
Expand All @@ -208,7 +208,7 @@ static void writeParametersToFile(char* resultsFile, InputFiles inputFiles, Algo
else
myfile << "no" << endl;
myfile.close();
};
}
// read ground truth depth map file (dmb) (provided by Tola et al. "DAISY: A Fast Local Descriptor for Dense Matching" http://cvlab.epfl.ch/software/daisy)
static int readDmbNormal (const char *filename, Mat_<Vec3f> &img)
{
Expand Down Expand Up @@ -438,4 +438,4 @@ static int readPfm( const char *filename,
fclose(inimage);
return 0;

};
}
Loading

0 comments on commit 84a1825

Please sign in to comment.