Get the ratio of the template frame. Add a README.md
This commit is contained in:
parent
5924c65b39
commit
ae0c3bfa39
|
@ -0,0 +1,12 @@
|
||||||
|
# Animation Scripts
|
||||||
|
|
||||||
|
This repository contains scripts and other tools for 2D digital to analog anamation.
|
||||||
|
|
||||||
|
|
||||||
|
## fourcell.sh
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```
|
||||||
|
bash fourcell.sh example.calibration.json dir/of/images output/dir
|
||||||
|
```
|
17
common.sh
17
common.sh
|
@ -51,4 +51,21 @@ axdraw () {
|
||||||
echo "START:$(date '+%s')"
|
echo "START:$(date '+%s')"
|
||||||
ax "${1}" 2>&1
|
ax "${1}" 2>&1
|
||||||
echo "END:$(date '+%s')"
|
echo "END:$(date '+%s')"
|
||||||
|
}
|
||||||
|
|
||||||
|
get_outer_ratio () {
|
||||||
|
|
||||||
|
AX=$(cat "${1}" | jq -r '.["0"]["0"].x')
|
||||||
|
AY=$(cat "${1}" | jq -r '.["0"]["0"].y')
|
||||||
|
BX=$(cat "${1}" | jq -r '.["0"]["1"].x')
|
||||||
|
BY=$(cat "${1}" | jq -r '.["0"]["1"].y')
|
||||||
|
CX=$(cat "${1}" | jq -r '.["0"]["2"].x')
|
||||||
|
CY=$(cat "${1}" | jq -r '.["0"]["2"].y')
|
||||||
|
DX=$(cat "${1}" | jq -r '.["0"]["3"].x')
|
||||||
|
DY=$(cat "${1}" | jq -r '.["0"]["3"].y')
|
||||||
|
ACX=$(echo "${CX}-${AX}" | bc)
|
||||||
|
DBX=$(echo "${DX}-${BX}" | bc)
|
||||||
|
ACY=$(echo "${AY}-${CY}" | bc)
|
||||||
|
DBY=$(echo "${DY}-${BY}" | bc)
|
||||||
|
echo "scale=4;((${ACY}+${DBY})/2) / ((${ACX}+${DBX})/2)" | bc
|
||||||
}
|
}
|
|
@ -3,7 +3,7 @@
|
||||||
#set -e
|
#set -e
|
||||||
|
|
||||||
if [[ "${1}" == "" ]]; then
|
if [[ "${1}" == "" ]]; then
|
||||||
echo "Please provide a calibration JSON"
|
echo "Please provide a template JSON"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${2}" == "" ]]; then
|
if [[ "${2}" == "" ]]; then
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source ./common.sh
|
||||||
|
|
||||||
|
get_outer_ratio "${1}"
|
|
@ -1,4 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
source ./common.sh
|
||||||
|
|
||||||
#iWidth 323 = oWidth 404
|
#iWidth 323 = oWidth 404
|
||||||
#iHeight 242 = oHeight 374
|
#iHeight 242 = oHeight 374
|
||||||
|
|
||||||
|
@ -7,6 +10,11 @@ SCALE=$(echo "scale=$DIGITS; 323/404" | bc)
|
||||||
OUTER=$(echo "scale=$DIGITS; 374/404" | bc)
|
OUTER=$(echo "scale=$DIGITS; 374/404" | bc)
|
||||||
RATIO=$(echo "scale=$DIGITS; 242/323" | bc)
|
RATIO=$(echo "scale=$DIGITS; 242/323" | bc)
|
||||||
|
|
||||||
|
# current ratio 1.088
|
||||||
|
# template ratio 1.291
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if [[ "${1}" != "" ]]; then
|
if [[ "${1}" != "" ]]; then
|
||||||
DPI=${1}
|
DPI=${1}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue