lib: re-add partial image flag

And activate perimeter points removal if this flag is set

This flag should be set for aes1610, aesx660, aes2501, aes2550
and upektc_img since these sensors may produce incomplete image.

Fixes: #142
This commit is contained in:
Vasily Khoruzhick 2020-06-03 20:44:13 -07:00
parent 297236b51a
commit 4cf5f92a52
8 changed files with 12 additions and 1 deletions

View file

@ -614,6 +614,7 @@ capture_read_strip_cb (FpiUsbTransfer *transfer, FpDevice *device,
self->strips = g_slist_reverse (self->strips); self->strips = g_slist_reverse (self->strips);
fpi_do_movement_estimation (&assembling_ctx, self->strips); fpi_do_movement_estimation (&assembling_ctx, self->strips);
img = fpi_assemble_frames (&assembling_ctx, self->strips); img = fpi_assemble_frames (&assembling_ctx, self->strips);
img->flags |= FPI_IMAGE_PARTIAL;
g_slist_free_full (self->strips, g_free); g_slist_free_full (self->strips, g_free);
self->strips = NULL; self->strips = NULL;

View file

@ -458,6 +458,7 @@ capture_read_strip_cb (FpiUsbTransfer *transfer, FpDevice *_dev,
fpi_do_movement_estimation (&assembling_ctx, self->strips); fpi_do_movement_estimation (&assembling_ctx, self->strips);
img = fpi_assemble_frames (&assembling_ctx, img = fpi_assemble_frames (&assembling_ctx,
self->strips); self->strips);
img->flags |= FPI_IMAGE_PARTIAL;
g_slist_free_full (self->strips, g_free); g_slist_free_full (self->strips, g_free);
self->strips = NULL; self->strips = NULL;
self->strips_len = 0; self->strips_len = 0;

View file

@ -230,6 +230,7 @@ capture_set_idle_reqs_cb (FpiUsbTransfer *transfer,
self->strips = g_slist_reverse (self->strips); self->strips = g_slist_reverse (self->strips);
img = fpi_assemble_frames (&assembling_ctx, self->strips); img = fpi_assemble_frames (&assembling_ctx, self->strips);
img->flags |= FPI_IMAGE_PARTIAL;
g_slist_free_full (self->strips, g_free); g_slist_free_full (self->strips, g_free);
self->strips = NULL; self->strips = NULL;
self->strips_len = 0; self->strips_len = 0;

View file

@ -331,6 +331,7 @@ capture_set_idle_cmd_cb (FpiUsbTransfer *transfer, FpDevice *device,
priv->strips = g_slist_reverse (priv->strips); priv->strips = g_slist_reverse (priv->strips);
img = fpi_assemble_frames (cls->assembling_ctx, priv->strips); img = fpi_assemble_frames (cls->assembling_ctx, priv->strips);
img->flags |= FPI_IMAGE_PARTIAL;
g_slist_foreach (priv->strips, (GFunc) g_free, NULL); g_slist_foreach (priv->strips, (GFunc) g_free, NULL);
g_slist_free (priv->strips); g_slist_free (priv->strips);
priv->strips = NULL; priv->strips = NULL;

View file

@ -325,6 +325,7 @@ elan_submit_image (FpImageDevice *dev)
g_slist_foreach (raw_frames, (GFunc) self->process_frame, &frames); g_slist_foreach (raw_frames, (GFunc) self->process_frame, &frames);
fpi_do_movement_estimation (&assembling_ctx, frames); fpi_do_movement_estimation (&assembling_ctx, frames);
img = fpi_assemble_frames (&assembling_ctx, frames); img = fpi_assemble_frames (&assembling_ctx, frames);
img->flags |= FPI_IMAGE_PARTIAL;
g_slist_free_full (frames, g_free); g_slist_free_full (frames, g_free);

View file

@ -310,6 +310,7 @@ capture_read_data_cb (FpiUsbTransfer *transfer, FpDevice *device,
fp_dbg ("Image size is %lu\n", fp_dbg ("Image size is %lu\n",
self->image_size); self->image_size);
img = fp_image_new (IMAGE_WIDTH, IMAGE_HEIGHT); img = fp_image_new (IMAGE_WIDTH, IMAGE_HEIGHT);
img->flags |= FPI_IMAGE_PARTIAL;
memcpy (img->data, self->image_bits, memcpy (img->data, self->image_bits,
IMAGE_SIZE); IMAGE_SIZE);
fpi_image_device_image_captured (dev, img); fpi_image_device_image_captured (dev, img);

View file

@ -281,6 +281,7 @@ fp_image_detect_minutiae_thread_func (GTask *task,
gint map_w, map_h; gint map_w, map_h;
gint bw, bh, bd; gint bw, bh, bd;
gint r; gint r;
g_autofree LFSPARMS *lfsparms;
/* Normalize the image first */ /* Normalize the image first */
if (data->flags & FPI_IMAGE_H_FLIPPED) if (data->flags & FPI_IMAGE_H_FLIPPED)
@ -294,12 +295,15 @@ fp_image_detect_minutiae_thread_func (GTask *task,
data->flags &= ~(FPI_IMAGE_H_FLIPPED | FPI_IMAGE_V_FLIPPED | FPI_IMAGE_COLORS_INVERTED); data->flags &= ~(FPI_IMAGE_H_FLIPPED | FPI_IMAGE_V_FLIPPED | FPI_IMAGE_COLORS_INVERTED);
lfsparms = g_memdup (&g_lfsparms_V2, sizeof (LFSPARMS));
lfsparms->remove_perimeter_pts = data->flags & FPI_IMAGE_PARTIAL ? TRUE : FALSE;
timer = g_timer_new (); timer = g_timer_new ();
r = get_minutiae (&minutiae, &quality_map, &direction_map, r = get_minutiae (&minutiae, &quality_map, &direction_map,
&low_contrast_map, &low_flow_map, &high_curve_map, &low_contrast_map, &low_flow_map, &high_curve_map,
&map_w, &map_h, &bdata, &bw, &bh, &bd, &map_w, &map_h, &bdata, &bw, &bh, &bd,
data->image, data->width, data->height, 8, data->image, data->width, data->height, 8,
data->ppmm, &g_lfsparms_V2); data->ppmm, lfsparms);
g_timer_stop (timer); g_timer_stop (timer);
fp_dbg ("Minutiae scan completed in %f secs", g_timer_elapsed (timer, NULL)); fp_dbg ("Minutiae scan completed in %f secs", g_timer_elapsed (timer, NULL));

View file

@ -37,6 +37,7 @@ typedef enum {
FPI_IMAGE_V_FLIPPED = 1 << 0, FPI_IMAGE_V_FLIPPED = 1 << 0,
FPI_IMAGE_H_FLIPPED = 1 << 1, FPI_IMAGE_H_FLIPPED = 1 << 1,
FPI_IMAGE_COLORS_INVERTED = 1 << 2, FPI_IMAGE_COLORS_INVERTED = 1 << 2,
FPI_IMAGE_PARTIAL = 1 << 3,
} FpiImageFlags; } FpiImageFlags;
/** /**