gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master 65e76f9c: Warp: remove unwanted implicit trans


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 65e76f9c: Warp: remove unwanted implicit translation
Date: Fri, 12 Apr 2024 23:15:24 -0400 (EDT)

branch: master
commit 65e76f9c7aedcc9b8b8bcdac194340652be71fe0
Author: Giacomo Lorenzetti <glorenzetti@cefca.es>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    Warp: remove unwanted implicit translation
    
    Until now, when '--translate' was invoked in warp, it performed a "silent"
    (1,1) translation. In addition to this, the size of the image is
    incremented more than necessary.
    
    With this commit, the operated translation is the intended one. This was
    done by setting the minimum 'outfpixval' to (1,1), as in the
    non-translational case, instead of (0,0). I also changed the correction to
    'dsize' correction: in case of a decimal translation, a +1 already occur in
    the main computation, so it is not needed. That +1 in the correction also
    led to wrong computations in the case of a translation along only one axis.
    
    This bug was reported by Raul Infante-Sainz.
    
    This fixes bug #63026.
---
 NEWS            | 4 ++++
 bin/warp/warp.c | 8 ++++----
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/NEWS b/NEWS
index ac735543..ed9c8f4c 100644
--- a/NEWS
+++ b/NEWS
@@ -157,6 +157,10 @@ See the end of the file for license conditions.
   - bug #65561: Projections to infinity cause very long running time in
     Warp. Found and fixed by Giacomo Lorenzetti.
 
+  - bug #63026: Warp translation adds one extra pixel even if it is not
+    requested. Reported by Raul Infante-Sainz and fixed by Giacomo
+    Lorenzetti.
+
 
 
 
diff --git a/bin/warp/warp.c b/bin/warp/warp.c
index 0f6357cd..24d72d54 100644
--- a/bin/warp/warp.c
+++ b/bin/warp/warp.c
@@ -321,10 +321,10 @@ warp_linear_init(struct warpparams *p)
      but in that scenario, we don't want this feature! */
   if( p->centeroncorner==0 && (matrix[2]!=0.0f || matrix[5]!=0.0f) )
     {
-      dsize[1] += abs( (int)(matrix[2]) )+1; /* (int): avoid warnings. */
-      dsize[0] += abs( (int)(matrix[5]) )+1;
-      if(xmin>0) p->outfpixval[0]=0;
-      if(ymin>0) p->outfpixval[1]=0;
+      dsize[1] += abs( (int)(matrix[2]) ); /* (int): avoid warnings. */
+      dsize[0] += abs( (int)(matrix[5]) );
+      if(xmin>0) p->outfpixval[0]=1;
+      if(ymin>0) p->outfpixval[1]=1;
     }
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]