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

[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.




Không có nhận xét nào:

Đăng nhận xét