From df798dcc60e7f7c20d605abd413ae16534169453 Mon Sep 17 00:00:00 2001
From: "raffaele.gaetano" <raffaele.gaetano@cirad.fr>
Date: Fri, 21 Apr 2023 16:29:30 +0200
Subject: [PATCH] ENH: optimizing tiepoint search.

---
 Common/geometry.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Common/geometry.py b/Common/geometry.py
index be94595..7955555 100644
--- a/Common/geometry.py
+++ b/Common/geometry.py
@@ -115,7 +115,8 @@ def compute_displacement_with_masks(_src: otb.Application, _tgt: otb.Application
     ref_mask = 1 - _tgt_msk.GetImageAsNumpyArray(out_param_tgt_msk)
     mask = np.all((mask, ref_mask), axis=0).astype(int)
     H, W = mask.shape
-    cnt, cov, cov_ext = get_patch_centers(mask, geobin_size, num_geobins, margin=margin)
+    ratio = np.sum(mask)/(H*W) #scale number of bins based on coverage ratio
+    cnt, cov, cov_ext = get_patch_centers(mask, geobin_size, int(ratio*num_geobins), margin=margin)
     _src_msk.FreeRessources()
     _tgt_msk.FreeRessources()
 
-- 
GitLab