Re: [fprint] Assembling of frames is broken

2018-03-04 Thread Igor Filatov
I confirm that this improves stitching. Especially with tall frames.

On Sat, Mar 3, 2018 at 12:07 AM Vasily Khoruzhick 
wrote:

> Hi Timur,
>
> On Wed, Feb 28, 2018 at 12:41 PM, Timur Celik  wrote:
> > 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.
>
> Thanks for report. I'll try to look into it this weekend.
>
> > ---
> > 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, _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, _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
> >
> > ___
> > fprint mailing list
> > fprint@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/fprint
> ___
> fprint mailing list
> fprint@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/fprint
>
___
fprint mailing list
fprint@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/fprint


Re: [fprint] Assembling of frames is broken

2018-03-02 Thread Vasily Khoruzhick
Hi Timur,

On Wed, Feb 28, 2018 at 12:41 PM, Timur Celik  wrote:
> 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.

Thanks for report. I'll try to look into it this weekend.

> ---
> 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, _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, _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
>
> ___
> fprint mailing list
> fprint@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/fprint
___
fprint mailing list
fprint@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/fprint


[fprint] Assembling of frames is broken

2018-02-28 Thread Timur Celik

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, _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, _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

___
fprint mailing list
fprint@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/fprint