diff options
author | Tomas Farago <sensej007@email.cz> | 2019-08-01 08:23:46 +0200 |
---|---|---|
committer | Tomas Farago <sensej007@email.cz> | 2020-02-05 10:16:26 +0100 |
commit | acbc885113a424f027a7416249539a934d3059c2 (patch) | |
tree | 7ec866b6e383807018504e04e2ffa8725944a343 | |
parent | c5c4855c86fa39f1d65ff8fffe96b6beb772814a (diff) | |
download | ufo-filters-acbc885113a424f027a7416249539a934d3059c2.tar.gz ufo-filters-acbc885113a424f027a7416249539a934d3059c2.tar.bz2 ufo-filters-acbc885113a424f027a7416249539a934d3059c2.tar.xz ufo-filters-acbc885113a424f027a7416249539a934d3059c2.zip |
NLM: add test
-rw-r--r-- | tests/CMakeLists.txt | 3 | ||||
-rw-r--r-- | tests/meson.build | 3 | ||||
-rwxr-xr-x | tests/test-nlm.sh | 11 |
3 files changed, 16 insertions, 1 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index ddb567c..8de94f1 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -20,3 +20,6 @@ add_test(test_177 add_test(test_core_149 ${BASH} "${CMAKE_CURRENT_SOURCE_DIR}/test-core-149.sh") + +add_test(test_nlm + ${BASH} "${CMAKE_CURRENT_SOURCE_DIR}/test-nlm.sh") diff --git a/tests/meson.build b/tests/meson.build index f95722f..6b720d2 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -3,7 +3,8 @@ tests = [ 'test-153', 'test-161', 'test-core-149', - 'test-file-write-regression' + 'test-file-write-regression', + 'test-nlm' ] tiffinfo = find_program('tiffinfo', required : false) diff --git a/tests/test-nlm.sh b/tests/test-nlm.sh new file mode 100755 index 0000000..09b75dd --- /dev/null +++ b/tests/test-nlm.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +python -c "import numpy; import tifffile; tifffile.imsave('nlm-noise-input.tif', +numpy.random.normal(100., 10., size=(128, 128)).astype(numpy.float32))" + +ufo-launch -q read path=nlm-noise-input.tif ! non-local-means patch-radius=3 search-radius=5 fast=False estimate-sigma=True addressing-mode=mirrored_repeat window=False ! write filename=ufo-nlm-slow.tif + +ufo-launch -q read path=nlm-noise-input.tif ! non-local-means patch-radius=3 search-radius=5 fast=True estimate-sigma=True addressing-mode=mirrored_repeat ! write filename=ufo-nlm-fast.tif + +# Fast and slow difference with respect to the mean must be less than 0.001 % +python -c "import sys; import tifffile; a = tifffile.imread('ufo-nlm-slow.tif'); b = tifffile.imread('ufo-nlm-fast.tif'); sys.exit(int(abs(a - b).max() > 1e-3))" |