Skip to content
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

Warn users that if a dataset has no GPS info, but split-merge is enabled #1012

Closed
pierotofy opened this issue Jul 30, 2019 · 4 comments · Fixed by #1521
Closed

Warn users that if a dataset has no GPS info, but split-merge is enabled #1012

pierotofy opened this issue Jul 30, 2019 · 4 comments · Fixed by #1521

Comments

@pierotofy
Copy link
Member

split-merge either needs GPS info or a image_groups.txt file to split a dataset.

Otherwise it cannot work. The program should help users understand that instead of failing with :

OpenCV Error: Assertion failed (data0.dims <= 2 && type == CV_32F && K > 0) in kmeans, file /code/SuperBuild/src/opencv/modules/core/src/matrix.cpp, line 2701
Traceback (most recent call last):
  File "/code/SuperBuild/src/opensfm/bin/opensfm", line 34, in <module>
    command.run(args)
  File "/code/SuperBuild/src/opensfm/opensfm/commands/create_submodels.py", line 30, in run
    self._cluster_images(meta_data, data.config['submodel_size'])
  File "/code/SuperBuild/src/opensfm/opensfm/commands/create_submodels.py", line 100, in _cluster_images
    labels, centers = tools.kmeans(positions, K)[1:]
  File "/code/SuperBuild/src/opensfm/opensfm/large/tools.py", line 34, in kmeans
    return cv2.kmeans(samples, nclusters, criteria, attempts, flags)
cv2.error: /code/SuperBuild/src/opencv/modules/core/src/matrix.cpp:2701: error: (-215) data0.dims <= 2 && type == CV_32F && K > 0 in function kmeans
@theoway
Copy link
Contributor

theoway commented Aug 4, 2022

@pierotofy I'd love to make a PR. Here's how I'm thinking of solving it. If you approve it, I'll make the changes then :)

  • Add a member variable self.has_geotagged_photos and a function has_gps() that indicates if GPS info is available.

    ODM/opendm/types.py

    Lines 94 to 95 in 6fee4be

    def has_gcp(self):
    return self.is_georeferenced() and self.gcp is not None and self.gcp.exists()

  • Perform a check here:

    ODM/stages/splitmerge.py

    Lines 25 to 32 in 6fee4be

    def process(self, args, outputs):
    tree = outputs['tree']
    reconstruction = outputs['reconstruction']
    photos = reconstruction.photos
    outputs['large'] = len(photos) > args.split
    if outputs['large']:

    Something like:

if reconstruction.is_georeferenced() and reconstruction.has_geotagged_photos():
    #perform actions
else:
    #log warning or exit

@pierotofy
Copy link
Member Author

Sounds like a good approach!

@theoway
Copy link
Contributor

theoway commented Aug 4, 2022

Sounds like a good approach!

Could you tell me what would be better? Exiting the process or just logging a warning?

@pierotofy
Copy link
Member Author

I would print a warning and try to process the dataset without split-merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants