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

apply_otf_to_image with RGB image ValueError #3

Open
PaulHax opened this issue Dec 12, 2024 · 6 comments
Open

apply_otf_to_image with RGB image ValueError #3

PaulHax opened this issue Dec 12, 2024 · 6 comments

Comments

@PaulHax
Copy link

PaulHax commented Dec 12, 2024

When nrtk-explorer calls nrtk.impls.perturb_image.pybsm.perturber.PybsmPerturber.execute with a RGB image, I'm getting an error:

  File "/home/paul/src/cdao/nrtk-explorer/src/nrtk_explorer/library/nrtk_transforms.py", line 195, in execute
    output_array = self._perturber.perturb(input_array, *input_args)
  File "/home/paul/src/cdao/nrtk-explorer/.venv/lib/python3.10/site-packages/nrtk/impls/perturb_image/pybsm/perturber.py", line 90, in perturb
    perturbed = simulate_image(ref_img, self.sensor(), self.scenario())[-1]
  File "/home/paul/src/cdao/nrtk-explorer/.venv/lib/python3.10/site-packages/pybsm/simulation/functional.py", line 263, in simulate_image
    blur_img, _ = otf.apply_otf_to_image(
  File "/home/paul/src/cdao/nrtk-explorer/.venv/lib/python3.10/site-packages/pybsm/otf/functional.py", line 1270, in apply_otf_to_image
    sim_img[:, :, channel] = resample_2D(blur_img[:, :, channel], ref_gsd / ref_range, ifov)
ValueError: could not broadcast input array from shape (459,792) into shape (791,459)

When I pip install pybsm==0.9.0 the error does not happen.

A related change:
31333ed#diff-e66ac4a4264ec700872ad660ab8344b8a8217edf335434772853d8d6786397a8R1260-R1278

@bjrichardwebster
Copy link
Contributor

Hi @PaulHax, right now pybsm==0.10.0 is broken and should not be used. We're in the middle of correcting this right now and will release fixes via 0.10.1, if those issues still persist after 0.10.1 is released then we will followup on this error in more detail. I'll keep you posted when 0.10.1 is released --- should be this week.

@bjrichardwebster
Copy link
Contributor

Hi @PaulHax, the bug we were fixing should be fixed. I don't know if it was the source of the bug here, but please feel free to go ahead and attempt pybsm==0.10.1 and let us know if it has been resolved. Thanks!

@PaulHax
Copy link
Author

PaulHax commented Dec 16, 2024

Thanks for update, it does not resolve the nrtk-explorer error though.

@bjrichardwebster
Copy link
Contributor

Thanks for letting us know. I'm going to create an Issue on the primary repo for this and have it worked on. With the holiday coming its not clear how quick we can get to it, are you going to be completely blocked without being able to use new pybsm versions?

@PaulHax
Copy link
Author

PaulHax commented Dec 16, 2024

Not blocked, no rush. We just limit our pybsm version to 0.9.0.

@barry-ravichandran
Copy link
Contributor

@PaulHax @bjrichardwebster I think the issue might be due to a height, width mismatch while assigning image size in the perturber and that being interchanged under-the-hood in pybsm. Even with that, there is a dimensionality mismatch of 1 in this case. I can look into fixing this as part of the upcoming sprint this week.

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

3 participants