8000 ImageReder new option and bug fix in GPS priors by anmatako · Pull Request #1146 · colmap/colmap · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ImageReder new option and bug fix in GPS priors #1146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Mar 9, 2021

Conversation

anmatako
Copy link
Contributor

Default behavior of ImageReader is now changed and it will attempt to reuse the same camera model if the model exif tag and image size remains the same. The old default of one camera per image can now be used through the explicit option --ImageReader.single_camera_per_image 1. Convenience input --camera_mode was added in feature_extractor to set the correct flags for ImageReader.

Fixed bug when reading GPS coordinates from EXIF tag where the Lat/Lon reference tag (N or S, and E or W) was being ignored resulting in incorrect GPS coordinates for locations outside the NE quadrant; coordinates were always positive instead of negative Lat for south hemisphere and negative Lon for West hemisphere.

< 8000 div id="commits-pushed-8e1f0b8" data-view-component="true" class="TimelineItem pb-1">
Antonios Matakos and others added 4 commits February 24, 2021 11:52
// Read camera model and check for consistency if it exists
//////////////////////////////////////////////////////////////////////////////
std::string camera_model = "Undefined";
bitmap->ExifCameraModel(&camera_model);
Copy link
Contributor
@ahojnnes ahojnnes Mar 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I read this code here correctly, then this would always select a single camera, if the camera_model == "Undefined"? This doesn't seem right. In case the camera_model is undefined, we want to instantiate a new camera for each image.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also check whether we successfully retrieved the camera_model by checking the return value of ExifCamerModel

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to the "hashing" by make, model, focal length, and width+height the call to ExifCameraModel will always return something meaningful even if it's just the "WidthxHeight" descriptor. Thus, even for missing EXIF tags it will still only group together images with the same dimensions (which I think is fine in this case) and won't force a single camera for the whole model.

Returning false from ExifCameraModel when an EXIF tag is missing will break the setup since the cameras_ is a map indexed by camera_model so we do want this to always succeed for the AUTO mode to work correctly. Returning an empty string would essentially be forcing the use of a single camera model in the AUTO mode when EXIF tags are missing. But, maybe that's a more acceptable behavior; I'm open to handle this in whichever way makes most sense to you.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, so correct me if I am wrong, but the way I understand the current behavior: if only width_height are available, then it will use the same camera for all images that only have width_height EXIF fields and where they are equal. The behavior I want is that: if any of the make/model/focal/width/height fields are missing, instantiate a new/independent camera for that image. I really only want to group them to a single camera, if all the fields are present and their values match exactly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK I see your take now; I can certainly do it this way. It will take a bit of restructuring but it will get there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now the logic should work correctly; tested locally and results agreed with expectation of camera models. The map used to keep track of existing camera models now gets populated only if the camera model is valid, thus cameras where the model cannot be found will not get grouped together.

std::string model_str;
std::string focal_length;
*camera_model = "";
if (ReadExifTag(FIMD_EXIF_MAIN, "Make", &make_str)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think each if block here should have an else { return false } and in the negative case also set camera_model = ""

std::string model_str;
std::string focal_length;
*camera_model = "";
if (ReadExifTag(FIMD_EXIF_MAIN, "Make", &make_str)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think each if block here should have an else { return false } and in the negative case also set camera_model = ""

@ahojnnes ahojnnes enabled auto-merge (squash) March 9, 2021 21:49
@ahojnnes ahojnnes disabled auto-merge March 9, 2021 21:50
@ahojnnes ahojnnes merged commit 2049579 into colmap:dev Mar 9, 2021
@anmatako anmatako deleted the public/im-reader branch March 9, 2021 21:55
lucasthahn pushed a commit to tne-ai/colmap that referenced this pull request Aug 17, 2022
* ImageReder new option and bug fix in GPS priors

* Add camera_mode option to feature_importer

* Minor feature_importer update

* Update Bitmap and CameraMode documentation

* Fix typo in coment

* Fix another small typo

* Update image_reader.h

* Update bitmap.cc

* Update colmap.cc

* Change camera mode handling in ImageReader

* Update CameraMode documentation

Co-authored-by: Antonios Matakos <anmatako@dss.microsoft.us>
Co-authored-by: Johannes Schönberger <jsch@demuc.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0