Two more patches for the upexonly driver. First one reduces the likelyhood of an accidental incomplete scan, the second one corrects the column offsets in resulting image, making it clearer and thus give more consistent results after binarization.
-- --Alexia
From a190a2ee2e21b794596979d1e19eb555ab5ceb91 Mon Sep 17 00:00:00 2001 From: Alexia Death <[email protected]> Date: Sat, 26 Dec 2009 17:02:03 +0200 Subject: [PATCH 1/2] Dont consider the scan complete unless there is atleast MIN_ROWS of print or a long gap Typical problem spot: one brief touch before starting the actual scan. Happens most commonly if scan is started form before first joint resulting in a gap after inital touch. --- libfprint/drivers/upeksonly.c | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/libfprint/drivers/upeksonly.c b/libfprint/drivers/upeksonly.c index ff2cb5a..09763f7 100644 --- a/libfprint/drivers/upeksonly.c +++ b/libfprint/drivers/upeksonly.c @@ -31,6 +31,7 @@ #define IMG_WIDTH 288 #define NUM_BULK_TRANSFERS 24 #define MAX_ROWS 700 +#define MIN_ROWS 64 struct img_transfer_data { int idx; @@ -219,13 +220,20 @@ static void row_complete(struct fp_img_dev *dev) int total; compute_rows(lastrow, sdev->rowbuf, &diff, &total); + if (total < 52000) { sdev->num_blank = 0; } else { sdev->num_blank++; - if (sdev->num_blank > 500) { + /* Dont consider the scan complete unless theres atleast MIN_ROWS recorded. + * or very long blank read occured. + * + * Typical problem spot: one brief touch before starting the actual scan. + * Happens most commonly if scan is started form before first joint + * resulting in a gap after inital touch.*/ + if ((sdev->num_blank > 500) && ((sdev->num_rows > MIN_ROWS) || (sdev->num_blank > 5000))) { sdev->finger_removed = 1; - fp_dbg("detected finger removal"); + fp_dbg("detected finger removal. Blank rows: %d, Full rows: %d", sdev->num_blank, sdev->num_rows); handoff_img(dev); return; } -- 1.6.3.3
From 5e515548f3f882866ed20f849469fdd3a59d283f Mon Sep 17 00:00:00 2001 From: Alexia Death <[email protected]> Date: Sat, 26 Dec 2009 18:22:41 +0200 Subject: [PATCH 2/2] upexonly.c: Fix a vertical distortion in image data In scan result every other column was distorted by 2 pixels down shift. This patch adds correction to this distortion resulting in a clearer image. --- libfprint/drivers/upeksonly.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/libfprint/drivers/upeksonly.c b/libfprint/drivers/upeksonly.c index 09763f7..bc8392f 100644 --- a/libfprint/drivers/upeksonly.c +++ b/libfprint/drivers/upeksonly.c @@ -159,6 +159,7 @@ static void handoff_img(struct fp_img_dev *dev) size_t size = IMG_WIDTH * sdev->num_rows; struct fp_img *img = fpi_img_new(size); GSList *elem = sdev->rows; + size_t offset = 0; if (!elem) { @@ -169,6 +170,24 @@ static void handoff_img(struct fp_img_dev *dev) fp_dbg("%d rows", sdev->num_rows); img->height = sdev->num_rows; +/* Every other column in scan is shifted down by 2 pixels. Correction of this distortion + * is slighly expesnsive, and it works tolerably without it, + * but the image resulting from the read is vertically distorted. + */ + if(sdev->num_rows > 2) { + GSList *elem_dest = sdev->rows; + GSList *elem_src = g_slist_nth(sdev->rows, 1); + + do { + for (int offs = 1; offs < IMG_WIDTH; offs=offs + 2) { + memcpy(elem_dest->data + offs, elem_src->data + offs, 1); + } + + elem_dest= g_slist_next(elem_dest); + + } while ((elem_src = g_slist_next(elem_src)) != NULL); + } + /* The scans from this device are rolled right by two colums * It feels a lot smarter to correct here than mess with it at * read time*/ -- 1.6.3.3
_______________________________________________ fprint mailing list [email protected] http://lists.reactivated.net/mailman/listinfo/fprint
