add documentation to fourcell

This commit is contained in:
Matt McWilliams 2024-01-10 09:43:32 -05:00
parent e8561cbb1f
commit 3d286cfd4d
2 changed files with 69 additions and 14 deletions

View File

@ -1,9 +1,4 @@
# Four Cell Script
Two scripts:
1. Analyzes a calibration sheet on the plotter to generate a template.
2. Takes cells and inserts them into the template 4 at a time.
# Four Cell Scripts
## Analysis Steps
@ -52,3 +47,63 @@ _______________ _______________
| | | |
--------------- ---------------
```
## normalize.py
Normalize a scanned hole punch image.
```
usage: normalize.py [-h] input output
positional arguments:
input Scan to normalize
output Normalized file to output
```
## calibrate.py
Create a calibration file, apply to a scanned page, or scale image to desired DPI.
```
usage: calibrate.py [-h] [--dpi DPI] [--input INPUT] [--output OUTPUT] [--calibration CALIBRATION] {generate,calibrate,scale}
positional arguments:
{generate,calibrate,scale}
The action to perform
options:
-h, --help show this help message and exit
--dpi DPI, -d DPI DPI to generate
--input INPUT, -i INPUT
Input file
--output OUTPUT, -o OUTPUT
Output file
--calibration CALIBRATION, -c CALIBRATION
Calibration file
```
## template.py
Create a template from normalized scan file.
```
usage: template.py [-h] normalized [registration]
positional arguments:
normalized Normalized scan to build template from.
registration Registration mark to use.
```
## apply_image.py
Create a printable rasterized image that can be hole punched and animated.
```
usage: apply_image.py [-h] name destination template ...
positional arguments:
name Name of project
destination File to output image to
template Template file to use
images Images to place as cells
```

View File

@ -22,6 +22,14 @@ MEASUREMENTS={
'F' : { 'y' : 100.0 } # Y 100mm
}
parser = argparse.ArgumentParser(description='Create a calibration file, apply to a scanned page, or scale image to desired DPI.')
parser.add_argument('action', help='The action to perform', choices=ACTIONS)
parser.add_argument('--dpi', '-d', help='DPI to generate', required=False, type=int)
parser.add_argument('--input', '-i', help='Input file', required=False)
parser.add_argument('--output', '-o', help='Output file', required=False)
parser.add_argument('--calibration', '-c', help='Calibration file', required=False)
args = parser.parse_args()
def create_blank(width, height):
rgb_color=(255,255,255)
image = np.zeros((height, width, 3), np.uint8)
@ -181,14 +189,6 @@ def scale (args) :
def main () :
parser = argparse.ArgumentParser(description='Create a calibration file, apply to a scanned page, or scale image to desired DPI.')
parser.add_argument('action', help='The action to perform', choices=ACTIONS)
parser.add_argument('--dpi', '-d', help='DPI to generate', required=False, type=int)
parser.add_argument('--input', '-i', help='Input file', required=False)
parser.add_argument('--output', '-o', help='Output file', required=False)
parser.add_argument('--calibration', '-c', help='Calibration file', required=False)
args = parser.parse_args()
if args.action == 'generate' :
generate(args)
elif args.action == 'calibrate' :