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

Skysat Imagery? #113

Open
dbonafilia opened this issue Mar 9, 2022 · 1 comment
Open

Skysat Imagery? #113

dbonafilia opened this issue Mar 9, 2022 · 1 comment

Comments

@dbonafilia
Copy link

Hi!

I'm trying to use this repo to get a point cloud from a stereo pair of Planet Skysat imagery. When I do so, it fails in the stereo matching step with an error message that doesnt point towards what's going wrong. Does this repo work with Planet Skysat imagery? If so can someone help me debug?

root@5cea892011a6:~/s2p# s2p /mnt/config.json
tile size: 800 675
total number of tiles: 8 (4 x 2)

discarding masked tiles...
done 8 / 8 tiles
Elapsed time: 0:00:00.336263

correcting pointing locally...
done 8 / 8 tiles
Elapsed time: 0:00:53.334744

correcting pointing globally...
Elapsed time: 0:00:00.002746

rectifying tiles...
done 8 / 8 tiles
Elapsed time: 0:00:08.994904

running stereo matching...
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/root/s2p/s2p/common.py", line 90, in run
stderr=sys.stderr, env=env)
File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'mgm -r -4871 -R 1890 -s vfit -t census -O 8 -confidence_consensusL /mnt/output_pair/tiles/row_0000000_height_675/col_0000000_width_800/pair_1/rectified_disp_confidence.tif /mnt/output_pair/tiles/row_0000000_height_675/col_0000000_width_800/pair_1/rectified_ref.tif /mnt/output_pair/tiles/row_0000000_height_675/col_0000000_width_800/pair_1/rectified_sec.tif /mnt/output_pair/tiles/row_0000000_height_675/col_0000000_width_800/pair_1/rectified_disp.tif' returned non-zero exit status 137.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.6/multiprocessing/pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "/root/s2p/s2p/parallel.py", line 43, in tilewise_wrapper
out = fun(*args)
File "/root/s2p/s2p/init.py", line 205, in stereo_matching
disp_max)
File "/root/s2p/s2p/block_matching.py", line 162, in compute_disparity_map
env,
File "/root/s2p/s2p/common.py", line 96, in run
raise RunFailure({"command": e.cmd, "output": e.output})
s2p.common.RunFailure: {'command': 'mgm -r -4871 -R 1890 -s vfit -t census -O 8 -confidence_consensusL /mnt/output_pair/tiles/row_0000000_height_675/col_0000000_width_800/pair_1/rectified_disp_confidence.tif /mnt/output_pair/tiles/row_0000000_height_675/col_0000000_width_800/pair_1/rectified_ref.tif /mnt/output_pair/tiles/row_0000000_height_675/col_0000000_width_800/pair_1/rectified_sec.tif /mnt/output_pair/tiles/row_0000000_height_675/col_0000000_width_800/pair_1/rectified_disp.tif', 'output': None}
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/bin/s2p", line 11, in
load_entry_point('s2p', 'console_scripts', 's2p')()
File "/root/s2p/s2p/cli.py", line 22, in main
s2p.main(user_cfg)
File "/root/s2p/s2p/init.py", line 604, in main
parallel.launch_calls(stereo_matching, tiles_pairs, nb_workers)
File "/root/s2p/s2p/parallel.py", line 91, in launch_calls
outputs.append(r.get(600)) # wait at most 10 min per call
File "/usr/lib/python3.6/multiprocessing/pool.py", line 644, in get
raise self._value
s2p.common.RunFailure: {'command': 'mgm -r -4871 -R 1890 -s vfit -t census -O 8 -confidence_consensusL /mnt/output_pair/tiles/row_0000000_height_675/col_0000000_width_800/pair_1/rectified_disp_confidence.tif /mnt/output_pair/tiles/row_0000000_height_675/col_0000000_width_800/pair_1/rectified_ref.tif /mnt/output_pair/tiles/row_0000000_height_675/col_0000000_width_800/pair_1/rectified_sec.tif /mnt/output_pair/tiles/row_0000000_height_675/col_0000000_width_800/pair_1/rectified_disp.tif', 'output': None}

@gfacciol
Copy link
Member

Hi!
It seems that the disparity range is larger than the image and mgm ran out of memory
s2p.common.RunFailure: {'command': 'mgm -r -4871 -R 1890 -s vfit -t census -O 8 -confidence_consensusL...

We observed this issue with skysat images. It's related to the way in which we determine the disparity range from the RPC camera models. In short you should add the following line to your config.json

"disp_range_method" : "sift",

It will tell s2p to compute the disparity range from the sift matches and not blindly from the RPC.
There are also a couple of extra controls for the disparity range in case setting the range with sift does not work ideally.

# disp range expansion factor
cfg['disp_range_extra_margin'] = 0.2

# Maximum disparity range allowed in block matching
cfg['max_disp_range'] = None

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