nagadomi 8 лет назад
Родитель
Сommit
f1a45b19c5
1 измененных файлов с 14 добавлено и 0 удалено
  1. 14 0
      lib/iproc.lua

+ 14 - 0
lib/iproc.lua

@@ -367,10 +367,24 @@ local function test_gaussian2d()
       print(kp)
       print(kp)
    end
    end
 end
 end
+local function test_conv()
+   local image = require 'image'
+   local src = image.lena()
+   local kernel = torch.Tensor(3, 3):fill(1)
+   kernel:div(kernel:sum())
+   --local blur = iproc.convolve(iproc.padding(src, 1, 1, 1, 1), kernel, 'valid')
+   local blur = iproc.convolve(src, kernel, 'same')
+   print(src:size(), blur:size())
+   local diff = (blur - src):abs()
+   image.save("diff.png", diff)
+   image.display({image = blur, min=0, max=1})
+   image.display({image = diff, min=0, max=1})
+end
 
 
 --test_conversion()
 --test_conversion()
 --test_flip()
 --test_flip()
 --test_gaussian2d()
 --test_gaussian2d()
+--test_conv()
 
 
 return iproc
 return iproc