Thứ Năm, 29 tháng 3, 2018

[Fingerprint Algorithm - NBIS packet] How to optimize?

[MCU AVR32] Get fingerprint data successfully - Display image - Input to mindtct

After getting successfully FP data, we can send to our PC on various ways, but I use UART, and the terminal program is Xterm which allows me to record the log printed on screen.

Now we can get the log file, and after a preliminary step to remove meaningless parts of data, we now have this log file containing only our gray values of FP image.

At this stage, we will import this text file into MATLAB to see whether the data is correct or not.
We will run this script:

img = fileread('img2.log');
arr = textscan(img, '%d ');
arr_tmp = arr{1,1};
arr_tmp = cast(arr_tmp,'uint8');
arr_reshape = reshape(arr_tmp, 160, 160);
transpose = arr_reshape.';
imshow(transpose, [0 255])

My MATLAB code seems to be stupid. Hahah. Because I have seldom used MATLAB before.

Now, on MATLAB, we will get this image:
(1)
You can right-click to the image to see details about it. When i put this image to mindtct, I got this error:

As you can see, the depth of image is 24 which is not permitted with PNG image, then I have to use this tool to convert the image to the one having 8-bit depth.
http://convertimage.net/online-photo-effects/black-and-white-photo-fx.asp?i=20180330-030324-dsmck
It works fine.

However, when we take image from MATLAB, we might get a image including unexpected boundary like (1). For me, I use Snipping Tool available on Windows to remove white barriers. The output image will be like this:
If the size is not 160x160, you can use a number of tools (I use Pain 3D on Windows 10) to resize it. You, in addition, should double-check the bit depth after resizing to ensure that the depth is 8.

Now I can process the image normally and get minutiaes.




Thứ Tư, 28 tháng 3, 2018

[MCU AVR32] AVR32 vs FPC1021

Devices:
- Fingerprint sensor FPC1021
- MCU AT32UC3A3128S (128K Flash, 64 + 32x2 SRAM)

Follow this tutorial first to initialize SPI module in your device:
http://asf.atmel.com/docs/3.15.0/uc3a/html/avr32_drivers_spi_quick_start.html

Experiences:
- Did you manually pull CS_N pin to LOW and HIGH according to diagrams when you start a transmission?
- Ans: In this diagram, we have to pull the CS_N pin to LOW initially, then after command 0x24 is performed, we have to pull the pin to HIGH, followed by pulling the pin to LOW consequently. Next, we will send 0x1C and a dummy byte(0) before pulling the pin to HIGH again to finish transmission. Lastly, to get the data from the sensor, we first send command D4 before sending a long array of dummy byte to get image data.


- Did you send a dummy byte when you want to get a data byte?


Thứ Tư, 14 tháng 3, 2018

[Review sách] Kafka trên bờ biển - Haruki Murakami

Tôi dần nhìn thấy được con người của tác giả qua những câu chuyện của ông.

[Review sách] Cuộc đời của PI - Yann Martel


Câu chuyện được kể là một ký ức của một cậu bé thông minh.

Điều tôi ấn tượng nhất trong cuốn sách này là đoạn hai kẻ mù gặp nhau lênh đênh trên biển, và như để cứu rỗi cuộc sống hay bản năng muốn sống của con người trỗi dậy, một trong hai kẻ - dù không cố tình nhưng đã ăn thịt đồng loại của mình dưới sự trợ giúp của con hổ.

Điều thứ hai đó là đảo nổi chết chóc, những tưởng những tháng ngày của cậu bé PI sẽ ổn thỏa khi gặp được thức ăn và nước uống đầy đủ cho cả cậu và Richar Parker (tên chú hổ ở trên thuyền). Nhưng trớ trêu thay, đó lại là một cạm bẫy nữa của biển khơi. Khoảng khắc cậu bóc những quả và đếm đủ số quả bằng số răng người thực sự làm tôi ớn lạnh.