Compare commits
3 Commits
800b5af94e
...
89678edd8e
Author | SHA1 | Date |
---|---|---|
Matt McWilliams | 89678edd8e | |
Matt McWilliams | d57a145f1c | |
Matt McWilliams | 80e4d8e251 |
|
@ -33,3 +33,22 @@ _______________ _______________
|
|||
| | | |
|
||||
--------------- ---------------
|
||||
```
|
||||
|
||||
|
||||
## Calibration Layout Order
|
||||
|
||||
```
|
||||
_______________ _______________
|
||||
| | | |
|
||||
| 1 2 3 0 | | |
|
||||
| | | 1 2 |
|
||||
| | | |
|
||||
| 0 3 2 1 | | |
|
||||
| | | |
|
||||
| 1 2 3 0 | | |
|
||||
| | | |
|
||||
| | | 0 3 |
|
||||
| 0 3 2 1 | | |
|
||||
| | | |
|
||||
--------------- ---------------
|
||||
```
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
import cv2
|
||||
import numpy as np
|
||||
|
||||
#outer template
|
||||
outer = cv2.imread("graph.jpeg")
|
||||
#inner image
|
||||
inner = cv2.imread("emoji.jpeg")
|
||||
|
||||
rows, cols, ch = outer.shape
|
||||
ir, ic, ich = inner.shape
|
||||
|
||||
print(f'{cols}x{rows}')
|
||||
print(f'{ic}x{ir}')
|
||||
|
||||
# destination ponts on outer image
|
||||
pts1 = np.float32([[15, 15], [200, 30], [50, 140]])
|
||||
|
||||
# corresponding points on inner image
|
||||
pts2 = np.float32([[0, 0], [ic, 0], [0, ir]])
|
||||
|
||||
# transform inner to points on outer
|
||||
M = cv2.getAffineTransform(pts2, pts1)
|
||||
|
||||
# apply
|
||||
dst = cv2.warpAffine(inner, M, (cols, rows), borderMode=cv2.BORDER_TRANSPARENT)
|
||||
|
||||
final = outer.copy()
|
||||
final[0:rows, 0:cols] = dst
|
||||
cv2.imwrite("affine_poc.png", final)
|
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
|
@ -0,0 +1,34 @@
|
|||
# apply_images
|
||||
|
||||
* Take calibration json as argument
|
||||
* Create blank image of width and height
|
||||
* Place idealized circles where hole punches are supposed to be
|
||||
* Place fiducials in corners of images
|
||||
* Take up to 4 images as arguments
|
||||
* Perform AffineTransform on as many source locations as needed
|
||||
* Place images according to AffineTransform
|
||||
* Write final image out
|
||||
|
||||
### Potentials needs
|
||||
|
||||
* One time xy offset, calibrated to hole punches
|
||||
* Hole punch several sheets at the same time, calibrate to one and print on them
|
||||
* OR
|
||||
* Calibrate, then print on un-punched sheets and place guides for punching
|
||||
* (this may be less reliable)
|
||||
|
||||
# apply_svg
|
||||
|
||||
* Create svg document scaling width and height to 96dpi equivalent
|
||||
* Normalize all measurements to 96dpi equivalent
|
||||
* Place idealized circles where hole punches are supposed to be
|
||||
* Take up to 4 svg files as arguments
|
||||
* Find best fit for svg within 4 frames, rotation, scale and position
|
||||
* Place or embed or re-write svg within frame, one at a time
|
||||
* Write out final svg
|
||||
|
||||
|
||||
### Potential needs
|
||||
|
||||
* One time xy offset, calibrated to hole punches
|
||||
* Special board to draw this on (as opposed to free form mat)
|
Loading…
Reference in New Issue