You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
119 lines
3.2 KiB
119 lines
3.2 KiB
main module
|
|
===========
|
|
|
|
Main file of the project, contains filtering and stl generation functions
|
|
|
|
.. moduleauthor:: xlanro00
|
|
|
|
.. py:class:: main.fingerprint_app()
|
|
|
|
Main class for the application.
|
|
|
|
.. py:function:: main.__init__()
|
|
|
|
.. py:function:: main.parse_arguments()
|
|
|
|
Parse arguments from command line using argparse library.
|
|
|
|
.. py:function:: main.parse_stl()
|
|
|
|
Parse arguments for stl generation.
|
|
|
|
.. py:function:: 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.
|
|
|
|
.. py:function:: main.get_empty_figure()
|
|
|
|
Return empty figure with one ax, which has dimensions of the input image.
|
|
|
|
.. py:function:: main.mirror_image()
|
|
|
|
Mirror image using opencv.
|
|
Should be used to cancel implicit mirroring.
|
|
|
|
.. py:function:: main.apply_filters()
|
|
|
|
Apply filters to image one by one.
|
|
In case none were given, pass and save original image to the output file.
|
|
|
|
.. py:function:: main.save_image()
|
|
|
|
Save processed image to the output file.
|
|
|
|
:param fig: figure used to render image.
|
|
:param ax: Ax used to render image.
|
|
|
|
.. py:function:: main.run_stl()
|
|
|
|
Choose correct generation code based on mode.
|
|
|
|
.. py:function:: 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.
|
|
|
|
.. py:function:: 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.
|
|
|
|
.. py:function:: 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.
|
|
|
|
.. py:function:: main.append_faces()
|
|
|
|
Add faces to the list of faces.
|
|
|
|
:param faces: Array with faces.
|
|
:param c: Indices of currently added faces.
|
|
|
|
.. py:function:: main.engrave_text()
|
|
|
|
Engrave text on the back of the model.
|
|
Create an empty image, fill it with color and draw text on it.
|
|
|
|
:param bottom_vert_arr: Bottom vertex array.
|
|
:param top_vert_arr: Top vertex array
|
|
|
|
.. py:function:: main.create_stl_mesh()
|
|
|
|
Create mesh from faces and vertices arrays.
|
|
|
|
:param faces: Vector of face indices
|
|
:param vertices: Vector of vertices
|
|
|
|
.. py:function:: main.create_faces()
|
|
|
|
Create faces for the model.
|
|
Iterate over all vertices, append to vector and create faces from indices.
|
|
|
|
:param bottom_vert_arr: Bottom vertex array.
|
|
:param top_vert_arr: Top vertex array
|
|
|
|
.. py:function:: main.make_stl_planar()
|
|
|
|
Create vertices from meshgrid, add z coordinates from processed image heightmap.
|
|
Create faces from vertex indices.
|
|
|
|
.. py:function:: main.make_stl_curved()
|
|
|
|
Compute curved surface offset.
|
|
Create vertices from meshgrid, add z coordinates from processed image heightmap.
|
|
Create faces from vertex indices.
|
|
|
|
.. py:function:: main.make_stl_map()
|
|
|
|
Map fingerprint to a given finger model.
|
|
|
|
.. py:function:: main.save_stl()
|
|
|
|
Save final mesh to stl file.
|
|
|