centreborelli / s2p

Satellite Stereo Pipeline
GNU Affero General Public License v3.0
209 stars 67 forks source link

disp_to_xyz shape of mask #94

Closed rogermm14 closed 3 years ago

rogermm14 commented 3 years ago

Hello,

I was testing s2p on some WorldView-3 RGB images this morning, and I got the following error in my log file:

triangulating tiles...
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/usr/lib/python3.6/multiprocessing/pool.py", line 119, in worker
    result = (True, func(*args, **kwds))
  File "/home/rogermm14/s2p/s2p/parallel.py", line 43, in tilewise_wrapper
    out = fun(*args)
  File "/home/rogermm14/s2p/s2p/__init__.py", line 288, in disparity_to_ply
    A=np.loadtxt(pointing))
  File "/home/rogermm14/s2p/s2p/triangulation.py", line 143, in disp_to_xyz
    np.asarray(img_bbx, dtype='float32'))
ctypes.ArgumentError: argument 5: <class 'TypeError'>: array must have shape (357, 387)
"""

There seems to be a little misadjustment with the shape of the mask that is generated by create_rejection_mask in https://github.com/centreborelli/s2p/blob/eaa94dbb9e11f14d6f162c6b18a178505593591d/s2p/block_matching.py#L31 which is used as input in https://github.com/centreborelli/s2p/blob/eaa94dbb9e11f14d6f162c6b18a178505593591d/s2p/triangulation.py#L84

Basically the mask that is created has shape (3, rows, cols) as the input RGB image. I guess the channels dimension, if existent, should be dropped, since I managed to fix the issue for this kind of images by adding mask = mask[0, :, :].copy() in the disp_to_xyz function above.

Best, Roger

carlodef commented 3 years ago

Hi @rogermm14, thanks for reporting this issue. Are you using the latest version of the master branch?

This issue is supposed to have been fixed by commit ab68729.

rogermm14 commented 3 years ago

My apologies, you are absolutely right: I was pointing to an outdated master branch when I launched such tests. Tested again with the same data and the latest version of the code and everything went smooth and well. I am closing this issue. Thank you @carlodef !