pixie/tests/xrays.nim

15 lines
446 B
Nim
Raw Normal View History

2022-07-26 02:00:30 +00:00
import os, pixie, strformat, strutils
2022-07-09 05:56:18 +00:00
2022-07-09 18:08:34 +00:00
proc xray*(image: Image, masterPath: string) =
2022-07-09 05:56:18 +00:00
let
generatedPath = "tmp/generated/" & masterPath
xrayPath = "tmp/xray/" & masterPath
createDir(generatedPath.splitPath.head)
createDir(xrayPath.splitPath.head)
image.writeFile(generatedPath)
2022-07-09 05:56:18 +00:00
let
master = readImage(masterPath)
(score, xRay) = diff(image, master)
xRay.writeFile(xrayPath)
echo &"xray {masterPath} -> {score:0.6f}"