Skip to content

Commit

Permalink
Camera becomes simple data struct
Browse files Browse the repository at this point in the history
  • Loading branch information
sarlinpe committed Dec 7, 2023
1 parent a4de897 commit 84b2f9d
Show file tree
Hide file tree
Showing 6 changed files with 214 additions and 253 deletions.
2 changes: 1 addition & 1 deletion package/build-wheels-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ make install
cd $CURRDIR
git clone https://github.com/colmap/colmap.git
cd colmap
git checkout 0fb46f4d5304168131f4d8e5bdf9efc6a62ffd50
git checkout c0355417328f3706a30a9265fd52bc7a5aa4cb8c
mkdir build/
cd build/
CXXFLAGS="-fPIC" CFLAGS="-fPIC" cmake .. -DCMAKE_BUILD_TYPE=Release \
Expand Down
2 changes: 1 addition & 1 deletion package/build-wheels-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ brew install \
cd $CURRDIR
git clone https://github.com/colmap/colmap.git
cd colmap
git checkout 0fb46f4d5304168131f4d8e5bdf9efc6a62ffd50
git checkout c0355417328f3706a30a9265fd52bc7a5aa4cb8c
mkdir build
cd build
cmake .. -DGUI_ENABLED=OFF -DCUDA_ENABLED=OFF -DCGAL_ENABLED=OFF #-DBoost_USE_STATIC_LIBS=ON -DBOOSTROOT=${BOOST_DIR} -DBoost_NO_SYSTEM_PATHS=ON
Expand Down
17 changes: 8 additions & 9 deletions pipeline/images.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,18 @@ Camera infer_camera_from_image(const py::object image_path_,
std::invalid_argument,
(std::string("Cannot read image file: ") + image_path).c_str());

Camera camera;
camera.SetCameraId(kInvalidCameraId);
camera.SetModelIdFromName(options.camera_model);
double focal_length = 0.0;
if (bitmap.ExifFocalLength(&focal_length)) {
camera.SetPriorFocalLength(true);
} else {
bool has_prior_focal_length = bitmap.ExifFocalLength(&focal_length);
if (!has_prior_focal_length) {
focal_length = options.default_focal_length_factor *
std::max(bitmap.Width(), bitmap.Height());
camera.SetPriorFocalLength(false);
}
camera.InitializeWithId(
camera.ModelId(), focal_length, bitmap.Width(), bitmap.Height());
Camera camera = Camera::CreateFromModelName(kInvalidCameraId,
options.camera_model,
focal_length,
bitmap.Width(),
bitmap.Height());
camera.has_prior_focal_length = has_prior_focal_length;
THROW_CUSTOM_CHECK_MSG(
camera.VerifyParams(),
std::invalid_argument,
Expand Down
Loading

0 comments on commit 84b2f9d

Please sign in to comment.