facebookresearch / projectaria_tools

projectaria_tools is an C++/Python open-source toolkit to interact with Project Aria data
https://facebookresearch.github.io/projectaria_tools/docs/intro
Apache License 2.0
483 stars 64 forks source link

Mixup between aria width + height and between numpy shapes #106

Open AntonioMacaronio opened 4 months ago

AntonioMacaronio commented 4 months ago

Here is a potential bug: https://github.com/facebookresearch/projectaria_tools/blob/6338ce8024dd0d64b233b918864f78fcde8d739a/projectaria_tools/utils/calibration_utils.py#L30

input_calib_width refers to the width of the image. For an image represented as a NumPy array, the number of numpy columns is equal to the width of the image, but the code writes input_image.shape[0] != input_calib_width, which is comparing the number of numpy rows.

The same thing but vice versa happens on line 31 with input_image.shape[1] != input_calib_height

chpeng-fb commented 4 months ago

Hi @AntonioMacaronio, did you try printing out the value of input_image.shape and input_calib_width/height?

SeaOtocinclus commented 4 months ago

@AntonioMacaronio can you provide any feedback?

AntonioMacaronio commented 4 months ago

Yes! I can add quick one line PR to fix this if need be (i will also note the changes down below) - since the main RGB camera has solution 1404x1404, no runtime errors arise with that camera.

This only occurs with the side grayscale which have resolution 480x640. What happens is the following:

  1. input_image will be a numpy array of shape (480, 640),
  2. input_calib_width will be equal to 640, and input_calib_height will be equal to 480
  3. therefore the line checking if input_image.shape[0] != input_calib_width or input_image.shape[1] != input_calib_height: will be True and a ValueError will be raised.

Simply changing the conditional to if input_image.shape[1] != input_calib_width or input_image.shape[0] != input_calib_height: fixes this error