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

io/h5_to_micmac.py slicing problem with newer versions of h5py #82

Open
siparcs opened this issue Oct 12, 2024 · 0 comments
Open

io/h5_to_micmac.py slicing problem with newer versions of h5py #82

siparcs opened this issue Oct 12, 2024 · 0 comments
Assignees

Comments

@siparcs
Copy link

siparcs commented Oct 12, 2024

Hi

I'm not a programmer, but the following might be of interest to others.

h5_to_micmac.py sometimes results in the following error:

Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/data/io/h5_to_micmac.py", line 414, in
main()
File "/data/io/h5_to_micmac.py", line 402, in main
export_to_micmac(
File "/data/io/h5_to_micmac.py", line 262, in export_to_micmac
export_tie_points(feature_path, match_path, homol_dir)
File "/data/io/h5_to_micmac.py", line 202, in export_tie_points
x0y0, x1y1 = get_matches(feature_path, match_path, i0, i1)
File "/data/io/h5_to_micmac.py", line 92, in get_matches
x0y0 = features[key0]["keypoints"][matches0_idx[s0idx]]
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "/usr/local/lib/python3.10/dist-packages/h5py/_hl/dataset.py", line 854, in getitem
selection = sel.select(self.shape, args, dataset=self)
File "/usr/local/lib/python3.10/dist-packages/h5py/_hl/selections.py", line 82, in select
return selector.make_selection(args)
File "h5py/_selector.pyx", line 282, in h5py._selector.Selector.make_selection
File "h5py/_selector.pyx", line 215, in h5py._selector.Selector.apply_args
TypeError: Indexing elements must be in increasing order

It seems to occur mostly with large images (e.g. aerial scans of 17000x17000px), but it does not seem primarily a problem of image size. There seems to be a slicing problem occurring with newer versions of h5py (at least 3.6 and/to 3.12.1) in the following lines (88-89):

        # Get coordinates of matches
        x0y0 = features[key0]["keypoints"][matches0_idx[s0idx]]
        x1y1 = features[key1]["keypoints"][matches1_idx[s1idx]]

changing the lines to the following seems to resolve the error:

       x0y0 = features[key0]["keypoints"][:][matches0_idx[s0idx]]
       x1y1 = features[key1]["keypoints"][:][matches1_idx[s1idx]]

Could you check whether the above is correct?

@franioli franioli self-assigned this Oct 16, 2024
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

No branches or pull requests

2 participants