summaryrefslogtreecommitdiffstats
path: root/Wrappers
diff options
context:
space:
mode:
authorEdoardo Pasca <edo.paskino@gmail.com>2019-06-20 17:08:41 +0100
committerEdoardo Pasca <edo.paskino@gmail.com>2019-06-20 17:08:41 +0100
commit4904340f598fe2331c2aaf21ac0fb91da1168bdc (patch)
tree580db914c772c0757afa6b19efd02141857a0eed /Wrappers
parent79a39d8e85ffa69db7872816435eecda404f43ab (diff)
downloadframework-4904340f598fe2331c2aaf21ac0fb91da1168bdc.tar.gz
framework-4904340f598fe2331c2aaf21ac0fb91da1168bdc.tar.bz2
framework-4904340f598fe2331c2aaf21ac0fb91da1168bdc.tar.xz
framework-4904340f598fe2331c2aaf21ac0fb91da1168bdc.zip
added random_noise to TestData as staticmethod
Diffstat (limited to 'Wrappers')
-rwxr-xr-xWrappers/Python/ccpi/framework/TestData.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/Wrappers/Python/ccpi/framework/TestData.py b/Wrappers/Python/ccpi/framework/TestData.py
index 20931d7..afae8c8 100755
--- a/Wrappers/Python/ccpi/framework/TestData.py
+++ b/Wrappers/Python/ccpi/framework/TestData.py
@@ -1,15 +1,21 @@
# -*- coding: utf-8 -*-
-from ccpi.framework import ImageData, ImageGeometry
+from ccpi.framework import ImageData, ImageGeometry, DataContainer
import numpy
+import numpy as np
from PIL import Image
import os
import os.path
+import sys
data_dir = os.path.abspath(os.path.join(
os.path.dirname(__file__),
'../data/')
)
+data_dir = os.path.abspath(
+ os.path.join(sys.prefix, 'share','ccpi')
+)
+
class TestData(object):
BOAT = 'boat.tiff'
CAMERA = 'camera.png'
@@ -72,13 +78,13 @@ class TestData(object):
@staticmethod
def random_noise(image, mode='gaussian', seed=None, clip=True, **kwargs):
if issubclass(type(image), DataContainer):
- arr = scikit_random_noise(image, mode=mode, seed=seed, clip=clip,
+ arr = TestData.scikit_random_noise(image.as_array(), mode=mode, seed=seed, clip=clip,
**kwargs)
out = image.copy()
out.fill(arr)
return out
elif issubclass(type(image), numpy.ndarray):
- return scikit_random_noise(image, mode=mode, seed=seed, clip=clip,
+ return TestData.scikit_random_noise(image, mode=mode, seed=seed, clip=clip,
**kwargs)
@staticmethod