فهرست منبع

Add -depth option

nagadomi 9 سال پیش
والد
کامیت
57115bdcac
1فایلهای تغییر یافته به همراه3 افزوده شده و 2 حذف شده
  1. 3 2
      waifu2x.lua

+ 3 - 2
waifu2x.lua

@@ -50,7 +50,7 @@ local function convert_image(opt)
    else
    else
       error("undefined method:" .. opt.method)
       error("undefined method:" .. opt.method)
    end
    end
-   image_loader.save_png(opt.o, new_x, alpha)
+   image_loader.save_png(opt.o, new_x, alpha, opt.depth)
    print(opt.o .. ": " .. (sys.clock() - t) .. " sec")
    print(opt.o .. ": " .. (sys.clock() - t) .. " sec")
 end
 end
 local function convert_frames(opt)
 local function convert_frames(opt)
@@ -112,7 +112,7 @@ local function convert_frames(opt)
 	 else
 	 else
 	    output = string.format(opt.o, i)
 	    output = string.format(opt.o, i)
 	 end
 	 end
-	 image_loader.save_png(output, new_x, alpha)
+	 image_loader.save_png(output, new_x, alpha, opt.depth)
 	 xlua.progress(i, #lines)
 	 xlua.progress(i, #lines)
 	 if i % 10 == 0 then
 	 if i % 10 == 0 then
 	    collectgarbage()
 	    collectgarbage()
@@ -132,6 +132,7 @@ local function waifu2x()
    cmd:option("-l", "", 'path to image-list.txt')
    cmd:option("-l", "", 'path to image-list.txt')
    cmd:option("-scale", 2, 'scale factor')
    cmd:option("-scale", 2, 'scale factor')
    cmd:option("-o", "(auto)", 'path to output file')
    cmd:option("-o", "(auto)", 'path to output file')
+   cmd:option("-depth", 8, 'bit-depth of the output image (8|16)')
    cmd:option("-model_dir", "./models/anime_style_art_rgb", 'path to model directory')
    cmd:option("-model_dir", "./models/anime_style_art_rgb", 'path to model directory')
    cmd:option("-m", "noise_scale", 'method (noise|scale|noise_scale)')
    cmd:option("-m", "noise_scale", 'method (noise|scale|noise_scale)')
    cmd:option("-noise_level", 1, '(1|2)')
    cmd:option("-noise_level", 1, '(1|2)')