pixie/tests/xrays.nim

18 lines
525 B
Nim
Raw Normal View History

2022-07-09 05:56:18 +00:00
import pixie, strformat, os, strutils
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}"
2022-07-09 18:08:34 +00:00
proc xray*(mask: Mask, masterPath: string) =
mask.newImage.xray(masterPath)