Skip to content

Commit b8d1dfd

Browse files
committed
Add more camera models in the Undistorter (PR tum-vision#19)
1 parent 3feba2f commit b8d1dfd

6 files changed

+200
-208
lines changed

CMakeLists.txt

100755100644
+5-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
55

66
set(BUILD_TYPE Release)
77

8+
set(CMAKE_GENERATOR "Ninja")
9+
810
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
911

1012
set(EXECUTABLE_OUTPUT_PATH bin)
@@ -25,10 +27,10 @@ include_directories(
2527
)
2628

2729

28-
add_executable(responseCalib src/main_responseCalib.cpp src/FOVUndistorter.cpp src/PhotometricUndistorter.cpp)
30+
add_executable(responseCalib src/main_responseCalib.cpp src/FOVUndistorter.cpp src/Undistorter.cpp src/PhotometricUndistorter.cpp)
2931
target_link_libraries(responseCalib ${OpenCV_LIBS} ${LIBZIP_LIBRARY})
3032

31-
add_executable(playDataset src/main_playbackDataset.cpp src/FOVUndistorter.cpp src/PhotometricUndistorter.cpp)
33+
add_executable(playDataset src/main_playbackDataset.cpp src/FOVUndistorter.cpp src/Undistorter.cpp src/PhotometricUndistorter.cpp)
3234
target_link_libraries(playDataset ${OpenCV_LIBS} ${LIBZIP_LIBRARY})
3335

3436

@@ -40,7 +42,7 @@ SET(CMAKE_MODULE_PATH ${CMAKE_INSTALL_PREFIX}/lib/cmake/ )
4042
find_package(aruco)
4143

4244
IF(aruco_FOUND)
43-
add_executable(vignetteCalib src/main_vignetteCalib.cpp src/FOVUndistorter.cpp src/PhotometricUndistorter.cpp)
45+
add_executable(vignetteCalib src/main_vignetteCalib.cpp src/FOVUndistorter.cpp src/Undistorter.cpp src/PhotometricUndistorter.cpp)
4446
target_link_libraries(vignetteCalib ${OpenCV_LIBS} ${aruco_LIBS} ${LIBZIP_LIBRARY})
4547
ELSE()
4648
message("================ aruco not found. not compiling vignetteCalib. ========================")

src/BenchmarkDatasetReader.h

100755100644
+14-6
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
#include <algorithm>
3636

3737
#include "opencv2/opencv.hpp"
38-
#include "FOVUndistorter.h"
38+
//#include "FOVUndistorter.h"
39+
#include "Undistorter.h"
3940
#include "PhotometricUndistorter.h"
4041

4142
#include "zip.h"
@@ -132,7 +133,8 @@ class DatasetReader
132133

133134

134135
// create undistorter.
135-
undistorter = new UndistorterFOV((path+"camera.txt").c_str());
136+
//undistorter = new UndistorterFOV((path+"camera.txt").c_str());
137+
undistorter = Undistort::getUndistorterForFile((path+"camera.txt").c_str());
136138
photoUndistorter = new PhotometricUndistorter(path+"pcalib.txt", path+"vignette.png",undistorter->getInputDims()[0],undistorter->getInputDims()[1]);
137139

138140

@@ -156,7 +158,12 @@ class DatasetReader
156158

157159
}
158160

159-
UndistorterFOV* getUndistorter()
161+
/*UndistorterFOV* getUndistorter()
162+
{
163+
return undistorter;
164+
}*/
165+
166+
Undistort* getUndistorter()
160167
{
161168
return undistorter;
162169
}
@@ -249,7 +256,7 @@ class DatasetReader
249256
if(!isZipped)
250257
{
251258
// CHANGE FOR ZIP FILE
252-
return cv::imread(files[id],CV_LOAD_IMAGE_GRAYSCALE);
259+
return cv::imread(files[id],cv::IMREAD_GRAYSCALE);
253260
}
254261
else
255262
{
@@ -271,7 +278,7 @@ class DatasetReader
271278
exit(1);
272279
}
273280
}
274-
return cv::imdecode(cv::Mat(readbytes,1,CV_8U, databuffer), CV_LOAD_IMAGE_GRAYSCALE);
281+
return cv::imdecode(cv::Mat(readbytes,1,CV_8U, databuffer), cv::IMREAD_GRAYSCALE);
275282
}
276283
}
277284

@@ -336,7 +343,8 @@ class DatasetReader
336343

337344

338345
// internal structures.
339-
UndistorterFOV* undistorter;
346+
//UndistorterFOV* undistorter;
347+
Undistort* undistorter;
340348
PhotometricUndistorter* photoUndistorter;
341349
zip_t* ziparchive;
342350
char* databuffer;

src/FOVUndistorter.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ UndistorterFOV::UndistorterFOV(const char* configFileName)
5555
std::ifstream infile(configFileName);
5656
if(!infile.good())
5757
{
58-
printf("Failed to read camera calibration (invalid format?)\nCalibration file: %s\n", configFileName);
58+
printf("Failed to read camera calibration [1] (invalid format?)\nCalibration file: %s\n", configFileName);
5959
return;
6060
}
6161

@@ -77,7 +77,7 @@ UndistorterFOV::UndistorterFOV(const char* configFileName)
7777
}
7878
else
7979
{
80-
printf("Failed to read camera calibration (invalid format?)\nCalibration file: %s\n", configFileName);
80+
printf("Failed to read camera calibration [2] (invalid format?)\nCalibration file: %s\n", configFileName);
8181
return;
8282
}
8383

0 commit comments

Comments
 (0)