denoise test improvements: save results, don't depend on Images

Fri, 20 Dec 2019 13:43:56 +0200

author
Tuomo Valkonen <tuomov@iki.fi>
date
Fri, 20 Dec 2019 13:43:56 +0200
changeset 25
1fba916f2b77
parent 24
f6630036e588
child 26
863711a498fe

denoise test improvements: save results, don't depend on Images

test/denoise.jl file | annotate | diff | comparison | revisions
--- a/test/denoise.jl	Thu Dec 19 23:29:21 2019 +0200
+++ b/test/denoise.jl	Fri Dec 20 13:43:56 2019 +0200
@@ -5,7 +5,11 @@
 __precompile__()
 
 using Printf
-using Images
+using FileIO
+using ColorTypes: Gray
+# ColorVectorSpace is only needed to ensure that conversions
+# between different ColorTypes are defined.
+import ColorVectorSpace
 import TestImages
 
 using AlgTools.Util
@@ -25,8 +29,8 @@
     verbose_iter = 10,
     maxiter = 1000,
     save_results = false,
-    save_iterations = false,
     image_name = "lighthouse",
+    save_iterations = false
 )
 
 #######################
@@ -44,7 +48,7 @@
     params = params ⬿ (save_prefix = save_prefix * params.image_name,)
 
     # Load image and add noise
-    b = Float64.(Gray.(TestImages.testimage(params.image_name)))
+    b = Float64.(Gray{Float64}.(TestImages.testimage(params.image_name)))
     b_noisy = b .+ params.noise_level.*randn(size(b)...)
 
     # Launch (background) visualiser
@@ -57,6 +61,10 @@
         perffile = params.save_prefix * ".txt"
         println("Saving " * perffile)
         write_log(perffile, st.log, "# params = $(params)\n")
+        fn = (t, ext) -> "$(params.save_prefix)_$(t).$(ext)"
+        save(File(format"PNG", fn("true", "png")), grayimg(b))
+        save(File(format"PNG", fn("data", "png")), grayimg(b_noisy))
+        save(File(format"PNG", fn("reco", "png")), grayimg(x))
     end
 
     # Exit background visualiser

mercurial