Hi!
Here comes a patch that should solve a few problems with aes1610. The changelog:
-Fixed seg fault when you don't move your finger on the sensor
-bz threshold is now 10 (instead of 15). I think it is ok for the moment. If we manage to get higher image quality in the future, we'll change that.
-max_frame is set to 350. 150 was too low => incomplete fingerprints
-the driver was designed to stop the acquisition as soon as it gets a blank frame (
=> incomplete fingerprints). Now it waits to have at least 50 blank frames before stopping.

With these changes, the reader should work better. Not perfect, but better. At least with mine.

Daniel, I'd like to look at the image quality. Can you tell me what you think about that? What step do you think is problematic? I only have images from my reader so it's not very easy to see what is wrong and what is ok.

I've begun working on the gain. I'm trying to understand how it works from my logs. I hope I'll be able to make a patch for this
soon...

Anthony
diff -aburN ../lib/libfprint/drivers/aes1610.c ./libfprint/drivers/aes1610.c
--- ../lib/libfprint/drivers/aes1610.c	2007-11-26 16:43:27.000000000 +0100
+++ ./libfprint/drivers/aes1610.c	2007-11-26 16:41:59.000000000 +0100
@@ -58,7 +58,7 @@
 #define FRAME_SIZE		(FRAME_WIDTH * FRAME_HEIGHT)
 /* maximum number of frames to read during a scan */
 /* FIXME reduce substantially */
-#define MAX_FRAMES		150
+#define MAX_FRAMES		350
 
 struct aes1610_regwrite {
 	unsigned char reg;
@@ -245,24 +245,6 @@
 	return (r < 0) ? r : 0;
 }
 
-/* Read the value of a specific register from a register dump */
-static int regval_from_dump(unsigned char *data, uint8_t target)
-{
-	if (*data != FIRST_AES1610_REG) {
-		fp_err("not a register dump");
-		return -EILSEQ;
-	}
-
-	if (!(FIRST_AES1610_REG <= target || target >= LAST_AES1610_REG)) {
-		fp_err("out of range");
-		return -EINVAL;
-	}
-
-	target -= FIRST_AES1610_REG;
-	target *= 2;
-	return data[target + 1];
-}
-
 /* find overlapping parts of frames */
 static unsigned int find_overlap(unsigned char *first_frame,
 	unsigned char *second_frame, unsigned int *min_error)
@@ -494,6 +476,7 @@
 	unsigned char *imgptr;
 	unsigned char buf[665];
 	int sum;
+	unsigned int count_blank = 0;
 	int i;
 
 	/* FIXME can do better here in terms of buffer management? */
@@ -521,9 +504,7 @@
 	memcpy(imgptr, buf + 1, 128*4);
 	imgptr += 128*4;
 
-	for (nstrips = 0; nstrips < MAX_FRAMES; nstrips++) {
-		int threshold;
-
+	for (nstrips = 2; nstrips < MAX_FRAMES - 2; nstrips++) {
 		r = write_regv(dev, strip_scan_reqs, G_N_ELEMENTS(strip_scan_reqs));
 		if (r < 0)
 			goto err;
@@ -552,6 +533,11 @@
 		}
 		fp_dbg("sum=%d", sum);
 		if (sum == 0)
+			count_blank++;
+		else
+			count_blank = 0;
+			
+		if (count_blank >= 50)
 			break;
 	}
 	
@@ -563,12 +549,14 @@
 		goto err;
 	memcpy(imgptr, buf + 1, 128*4);
 	imgptr += 128*4;
+	nstrips++;
 
 	r = read_data(dev, buf, 665);
 	if (r < 0)
 		goto err;
 	memcpy(imgptr, buf + 1, 128*4);
 	imgptr += 128*4;
+	nstrips++;
 	
 	if (nstrips == MAX_FRAMES)
 		fp_warn("swiping finger too slow?");
@@ -585,6 +573,12 @@
 		fp_dbg("reversed scan direction");
 	}
 
+	// img->height must be >= 12 (if not, we get seg fault)
+	// img->height = 8 when we don't move the finger on the sensor
+	// We set it to 12 to avoid a crash.
+	if (img->height < 12)
+		img->height = 12;
+	
 	for (i = 0; i < img->height * FRAME_WIDTH; i++)
 		img->data[i] = (cooked[i] << 4) | 0xf;
 
@@ -616,7 +610,7 @@
 	 * binarized scan quality is good, minutiae detection is accurate,
 	 * it's just that we get fewer minutiae than other scanners (less scanning
 	 * area) */
-	.bz3_threshold = 15,
+	.bz3_threshold = 10,
 
 	.init = dev_init,
 	.exit = dev_exit,
diff -aburN ../lib/patch_aes1610.patch ./patch_aes1610.patch
--- ../lib/patch_aes1610.patch	1970-01-01 01:00:00.000000000 +0100
+++ ./patch_aes1610.patch	2007-11-26 16:46:18.000000000 +0100
@@ -0,0 +1,105 @@
+diff -aburN ../lib/libfprint/drivers/aes1610.c ./libfprint/drivers/aes1610.c
+--- ../lib/libfprint/drivers/aes1610.c	2007-11-26 16:43:27.000000000 +0100
++++ ./libfprint/drivers/aes1610.c	2007-11-26 16:41:59.000000000 +0100
+@@ -58,7 +58,7 @@
+ #define FRAME_SIZE		(FRAME_WIDTH * FRAME_HEIGHT)
+ /* maximum number of frames to read during a scan */
+ /* FIXME reduce substantially */
+-#define MAX_FRAMES		150
++#define MAX_FRAMES		350
+ 
+ struct aes1610_regwrite {
+ 	unsigned char reg;
+@@ -245,24 +245,6 @@
+ 	return (r < 0) ? r : 0;
+ }
+ 
+-/* Read the value of a specific register from a register dump */
+-static int regval_from_dump(unsigned char *data, uint8_t target)
+-{
+-	if (*data != FIRST_AES1610_REG) {
+-		fp_err("not a register dump");
+-		return -EILSEQ;
+-	}
+-
+-	if (!(FIRST_AES1610_REG <= target || target >= LAST_AES1610_REG)) {
+-		fp_err("out of range");
+-		return -EINVAL;
+-	}
+-
+-	target -= FIRST_AES1610_REG;
+-	target *= 2;
+-	return data[target + 1];
+-}
+-
+ /* find overlapping parts of frames */
+ static unsigned int find_overlap(unsigned char *first_frame,
+ 	unsigned char *second_frame, unsigned int *min_error)
+@@ -494,6 +476,7 @@
+ 	unsigned char *imgptr;
+ 	unsigned char buf[665];
+ 	int sum;
++	unsigned int count_blank = 0;
+ 	int i;
+ 
+ 	/* FIXME can do better here in terms of buffer management? */
+@@ -521,9 +504,7 @@
+ 	memcpy(imgptr, buf + 1, 128*4);
+ 	imgptr += 128*4;
+ 
+-	for (nstrips = 0; nstrips < MAX_FRAMES; nstrips++) {
+-		int threshold;
+-
++	for (nstrips = 2; nstrips < MAX_FRAMES - 2; nstrips++) {
+ 		r = write_regv(dev, strip_scan_reqs, G_N_ELEMENTS(strip_scan_reqs));
+ 		if (r < 0)
+ 			goto err;
+@@ -552,6 +533,11 @@
+ 		}
+ 		fp_dbg("sum=%d", sum);
+ 		if (sum == 0)
++			count_blank++;
++		else
++			count_blank = 0;
++			
++		if (count_blank >= 50)
+ 			break;
+ 	}
+ 	
+@@ -563,12 +549,14 @@
+ 		goto err;
+ 	memcpy(imgptr, buf + 1, 128*4);
+ 	imgptr += 128*4;
++	nstrips++;
+ 
+ 	r = read_data(dev, buf, 665);
+ 	if (r < 0)
+ 		goto err;
+ 	memcpy(imgptr, buf + 1, 128*4);
+ 	imgptr += 128*4;
++	nstrips++;
+ 	
+ 	if (nstrips == MAX_FRAMES)
+ 		fp_warn("swiping finger too slow?");
+@@ -585,6 +573,12 @@
+ 		fp_dbg("reversed scan direction");
+ 	}
+ 
++	// img->height must be >= 12 (if not, we get seg fault)
++	// img->height = 8 when we don't move the finger on the sensor
++	// We set it to 12 to avoid a crash.
++	if (img->height < 12)
++		img->height = 12;
++	
+ 	for (i = 0; i < img->height * FRAME_WIDTH; i++)
+ 		img->data[i] = (cooked[i] << 4) | 0xf;
+ 
+@@ -616,7 +610,7 @@
+ 	 * binarized scan quality is good, minutiae detection is accurate,
+ 	 * it's just that we get fewer minutiae than other scanners (less scanning
+ 	 * area) */
+-	.bz3_threshold = 15,
++	.bz3_threshold = 10,
+ 
+ 	.init = dev_init,
+ 	.exit = dev_exit,
_______________________________________________
fprint mailing list
[email protected]
http://lists.reactivated.net/mailman/listinfo/fprint

Reply via email to