Skip to content

Commit

Permalink
Add more camera models in the Undistorter (PR tum-vision#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
WFram committed Nov 28, 2022
1 parent 3feba2f commit b8d1dfd
Show file tree
Hide file tree
Showing 6 changed files with 200 additions and 208 deletions.
8 changes: 5 additions & 3 deletions CMakeLists.txt
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

set(BUILD_TYPE Release)

set(CMAKE_GENERATOR "Ninja")

set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

set(EXECUTABLE_OUTPUT_PATH bin)
Expand All @@ -25,10 +27,10 @@ include_directories(
)


add_executable(responseCalib src/main_responseCalib.cpp src/FOVUndistorter.cpp src/PhotometricUndistorter.cpp)
add_executable(responseCalib src/main_responseCalib.cpp src/FOVUndistorter.cpp src/Undistorter.cpp src/PhotometricUndistorter.cpp)
target_link_libraries(responseCalib ${OpenCV_LIBS} ${LIBZIP_LIBRARY})

add_executable(playDataset src/main_playbackDataset.cpp src/FOVUndistorter.cpp src/PhotometricUndistorter.cpp)
add_executable(playDataset src/main_playbackDataset.cpp src/FOVUndistorter.cpp src/Undistorter.cpp src/PhotometricUndistorter.cpp)
target_link_libraries(playDataset ${OpenCV_LIBS} ${LIBZIP_LIBRARY})


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

IF(aruco_FOUND)
add_executable(vignetteCalib src/main_vignetteCalib.cpp src/FOVUndistorter.cpp src/PhotometricUndistorter.cpp)
add_executable(vignetteCalib src/main_vignetteCalib.cpp src/FOVUndistorter.cpp src/Undistorter.cpp src/PhotometricUndistorter.cpp)
target_link_libraries(vignetteCalib ${OpenCV_LIBS} ${aruco_LIBS} ${LIBZIP_LIBRARY})
ELSE()
message("================ aruco not found. not compiling vignetteCalib. ========================")
Expand Down
20 changes: 14 additions & 6 deletions src/BenchmarkDatasetReader.h
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
#include <algorithm>

#include "opencv2/opencv.hpp"
#include "FOVUndistorter.h"
//#include "FOVUndistorter.h"
#include "Undistorter.h"
#include "PhotometricUndistorter.h"

#include "zip.h"
Expand Down Expand Up @@ -132,7 +133,8 @@ class DatasetReader


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


Expand All @@ -156,7 +158,12 @@ class DatasetReader

}

UndistorterFOV* getUndistorter()
/*UndistorterFOV* getUndistorter()
{
return undistorter;
}*/

Undistort* getUndistorter()
{
return undistorter;
}
Expand Down Expand Up @@ -249,7 +256,7 @@ class DatasetReader
if(!isZipped)
{
// CHANGE FOR ZIP FILE
return cv::imread(files[id],CV_LOAD_IMAGE_GRAYSCALE);
return cv::imread(files[id],cv::IMREAD_GRAYSCALE);
}
else
{
Expand All @@ -271,7 +278,7 @@ class DatasetReader
exit(1);
}
}
return cv::imdecode(cv::Mat(readbytes,1,CV_8U, databuffer), CV_LOAD_IMAGE_GRAYSCALE);
return cv::imdecode(cv::Mat(readbytes,1,CV_8U, databuffer), cv::IMREAD_GRAYSCALE);
}
}

Expand Down Expand Up @@ -336,7 +343,8 @@ class DatasetReader


// internal structures.
UndistorterFOV* undistorter;
//UndistorterFOV* undistorter;
Undistort* undistorter;
PhotometricUndistorter* photoUndistorter;
zip_t* ziparchive;
char* databuffer;
Expand Down
4 changes: 2 additions & 2 deletions src/FOVUndistorter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ UndistorterFOV::UndistorterFOV(const char* configFileName)
std::ifstream infile(configFileName);
if(!infile.good())
{
printf("Failed to read camera calibration (invalid format?)\nCalibration file: %s\n", configFileName);
printf("Failed to read camera calibration [1] (invalid format?)\nCalibration file: %s\n", configFileName);
return;
}

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

Expand Down
Loading

0 comments on commit b8d1dfd

Please sign in to comment.