Click here to Skip to main content
15,880,725 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello forum members,

I am trying to use fingerprint device(grove fingerprint sensor).
I can get the data but I dont know how I convert in bmp file.Datasheet tell this sentence.

"ImageBuffer serves for image storage and the image format is 256*288 pixels.
When transferring through UART, to quicken speed, only the upper 4 bits of the pixel is transferred
(that is 16 grey degrees). And two adjacent pixels of the same row will form a byte before the
transferring. When uploaded to PC, the 16-grey-degree image will be extended to 256-grey-degree
format. That¡s 8-bit BMP format.
When transferring through USB, the image is 8-bit pixel, that¡s 256 grey degrees."


What can I do for that?
Thank you

What I have tried:

result[i++] = (byte)((bits & 0x0F) << 4);
result[i++] = (byte)(bits & 0xF0);
Posted
Updated 22-Nov-19 21:56pm
Comments
dheeram 15-Oct-20 13:37pm    
Please share the actual data you get so that we can try to convert and check if we get the image out of it.

The statement you have written looks correct. Small suggestion "(byte) ((bits & 0x0F) << 4);" and "(byte)bits << 4;" will do the same job.

Or you can design bit better

union
{
byte value;
unsigned one : 4;
unsigned two : 4;
} nibble;

you can set the bites and get the two set of 4 bits. Also you can set the two set of 4 bits and get 8bit data from "value".

1 solution

So start by looking at how you are connecting to it: via USART (i.e. standard serial port, RS232 or RS423) or USB as the data will be different.
If it's serial port, then you need to understand what it is saying: and I'm not sure without looking at actual data exactly what is going on. I suspect this is a bad translation of the original instructions.

I'd go back to the manufacturers site and see if they have sample software - most do - and look at that, see if it works, and then try to code your own version (if necessary) from there.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900