main module#
Main file of the project, contains filtering and stl generation functions
- class main.fingerprint_app#
Main class for the application.
- main.__init__()#
- main.parse_arguments()#
Parse arguments from command line using argparse library.
- main.parse_stl()#
Parse arguments for stl generation.
- main.run_filtering()#
Read input file, store as numpy.array, uint8, grayscale. Call function to apply the filters and a function to save it to output file.
- main.get_empty_figure()#
Return empty figure with one ax, which has dimensions of the input image.
- main.mirror_image()#
Mirror image using opencv. Should be used to cancel implicit mirroring.
- main.apply_filters()#
Apply filters to image one by one. In case none were given, pass and save original image to the output file.
- main.save_image()#
Save processed image to the output file.
- Parameters:
fig – figure used to render image.
ax – Ax used to render image.
- main.run_stl()#
Choose correct generation code based on mode.
- main.prepare_heightmap()#
Scale image values to get values from 0 to 255. Check validity of dimension parameters. Then compute base and papilar lines height. Prepare meshgrid, array which later serves to store point coordinates.
- main.write_stl_header()#
Write parameter string to stl header. This header is 80 bytes long, so the data needs to be shortened to fit. If the parameter string is too long, a warning is printed and the data is truncated.
- main.get_ID()#
Get a unique ID for the model, which is used in filename and on the model backside. Also create parameter string for stl header, which is used to create ID using hash function MD5.
- main.append_faces()#
Add faces to the list of faces.
- Parameters:
faces – Array with faces.
c – Indices of currently added faces.
- main.engrave_text()#
Engrave text on the back of the model. Create an empty image, fill it with color and draw text on it.
- Parameters:
bottom_vert_arr – Bottom vertex array.
top_vert_arr – Top vertex array
- main.create_stl_mesh()#
Create mesh from faces and vertices arrays.
- Parameters:
faces – Vector of face indices
vertices – Vector of vertices
- main.create_faces()#
Create faces for the model. Iterate over all vertices, append to vector and create faces from indices.
- Parameters:
bottom_vert_arr – Bottom vertex array.
top_vert_arr – Top vertex array
- main.make_stl_planar()#
Create vertices from meshgrid, add z coordinates from processed image heightmap. Create faces from vertex indices.
- main.make_stl_curved()#
Compute curved surface offset. Create vertices from meshgrid, add z coordinates from processed image heightmap. Create faces from vertex indices.
- main.make_stl_map()#
Map fingerprint to a given finger model.
- main.save_stl()#
Save final mesh to stl file.