# HG changeset patch # User Tuomo Valkonen # Date 1576842236 -7200 # Node ID 1fba916f2b778dd4a9633ef0888360afc09d8fec # Parent f6630036e5888c89b7569c953f569117a790724c denoise test improvements: save results, don't depend on Images diff -r f6630036e588 -r 1fba916f2b77 test/denoise.jl --- 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