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

creating constant fixed size for rectified_ref.tif and rectified_sec.tif #208

Open
thedodo opened this issue Mar 26, 2019 · 0 comments
Open

Comments

@thedodo
Copy link

thedodo commented Mar 26, 2019

Hi!

First of all great project and code I have been using it for a while now as a baseline for my own research!

Unfortunately I am am currently stuck with the following problem: I want to change the code so that all the resulting rectified images (reference and second, one large satellite image pair) of the tiles have always the same constant size. The best would be if the final size of the rectified_ref/rectified_sec.tif would be "tile_size x tile_size".

For now let's assume that the size of the AOI is divisible by the the tile_size (so no resize from adjust_tile_size ) and forget about the border problems of disparity maps (i.e. no margin) .
Then in s2plib/rectification.py in function rectify_pair:

  • You first find matches between ref and sec image using virtual rpc matches
  • Then the F matrix and the homography (H1, H2) is calculated using this matches
  • Then you calculate the max and min disparity range and set the horizontal margin to max(|disp_min|, |disp_max|, hmargin_config) AND compute a translation with the margins that you apply to the homopraphy matrices.

This is the part that I don't understand. Why is this necessary?

Afterwards you apply this homography to the points of the roi and calculate a bounding box? (comment compute output image size).

By try and error I found that if later in this function I write:

common.image_apply_homography(out1, im1, H1, tile_size, tile_size)

That the rectified images have the desired size but of course than when creating the point-cloud out of the disparity it fails (meaning that the tile is only have visible in the ply).

My best guess is that you do this enlargement of the image so that almost all the corresponding points are found in the pairs rather than needing huge overlapping areas. However it can create problems for instance if the AOI is very close to the sat. image border and this "resizing" does not work.

Hopefully I made my issue clear and someone can help me.

best regards

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

1 participant