[fprint] Assembling of frames is broken

Timur Celik clktmr at gmail.com
Wed Feb 28 20:41:45 UTC 2018


Hello everybody,

I have already discussed this with Igor. There are two different bugs 
in the assembling of frames. I think this needs some attention because 
it made libfprint unusable for me and it affects all sensors.

In forward mode every frame stores the delta from the previous frame, 
in reverse mode it stores the delta to the next frame. This causes 
images to use the wrong delta while assembling in forward mode. The 
resulting stitching artifacts may be subtle when the movement was 
continuous, because the deltas will be similar.

---
 libfprint/assembling.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/libfprint/assembling.c b/libfprint/assembling.c
index 1052f99..bf2ff13 100644
--- a/libfprint/assembling.c
+++ b/libfprint/assembling.c
@@ -279,11 +279,18 @@ struct fp_img *fpi_assemble_frames(struct 
fpi_frame_asmbl_ctx *ctx,
  do {
   fpi_frame = stripe->data;

-	y += fpi_frame->delta_y;
-	x += fpi_frame->delta_x;
+	if(reverse) {
+	y += fpi_frame->delta_y;
+	x += fpi_frame->delta_x;
+	}

   aes_blit_stripe(ctx, img, fpi_frame, x, y);

+	if(!reverse) {
+	y += fpi_frame->delta_y;
+	x += fpi_frame->delta_x;
+	}
+
   stripe = g_slist_next(stripe);
   i++;
  } while (i < stripes_len);
-- 
2.14.3


The second bug is in reverse mode. The last image is always misplaced 
because the sign of the delta vector isn't corrected. This bug is 
always be visible.

---
 libfprint/assembling.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libfprint/assembling.c b/libfprint/assembling.c
index bf2ff13..0781006 100644
--- a/libfprint/assembling.c
+++ b/libfprint/assembling.c
@@ -131,8 +131,8 @@ static unsigned int do_movement_estimation(struct 
fpi_frame_asmbl_ctx *ctx,

   if (reverse) {
    find_overlap(ctx, prev_stripe, cur_stripe, &min_error);
-	prev_stripe->delta_y = -prev_stripe->delta_y;
-	prev_stripe->delta_x = -prev_stripe->delta_x;
+	cur_stripe->delta_y = -cur_stripe->delta_y;
+	cur_stripe->delta_x = -cur_stripe->delta_x;
   }
   else
    find_overlap(ctx, cur_stripe, prev_stripe, &min_error);
-- 
2.14.3


I have opened a ticket on bugzilla 
(https://bugs.freedesktop.org/show_bug.cgi?id=105027) and hope to see 
this confirmed and merged soon.

Timur



More information about the fprint mailing list