当前位置: 首页>>代码示例>>Python>>正文


Python ndimage.spline_filter方法代码示例

本文整理汇总了Python中scipy.ndimage.spline_filter方法的典型用法代码示例。如果您正苦于以下问题:Python ndimage.spline_filter方法的具体用法?Python ndimage.spline_filter怎么用?Python ndimage.spline_filter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在scipy.ndimage的用法示例。


在下文中一共展示了ndimage.spline_filter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_affine_transform09

# 需要导入模块: from scipy import ndimage [as 别名]
# 或者: from scipy.ndimage import spline_filter [as 别名]
def test_affine_transform09(self):
        data = numpy.array([[4, 1, 3, 2],
                               [7, 6, 8, 5],
                               [3, 5, 3, 6]])
        for order in range(0, 6):
            if (order > 1):
                filtered = ndimage.spline_filter(data,
                                                           order=order)
            else:
                filtered = data
            out = ndimage.affine_transform(filtered,[[1, 0],
                                                               [0, 1]],
                                  [-1, -1], order=order, prefilter=False)
            assert_array_almost_equal(out, [[0, 0, 0, 0],
                                       [0, 4, 1, 3],
                                       [0, 7, 6, 8]]) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:18,代码来源:test_ndimage.py

示例2: test_affine_transform26

# 需要导入模块: from scipy import ndimage [as 别名]
# 或者: from scipy.ndimage import spline_filter [as 别名]
def test_affine_transform26(self):
        # test homogeneous coordinates
        data = numpy.array([[4, 1, 3, 2],
                            [7, 6, 8, 5],
                            [3, 5, 3, 6]])
        for order in range(0, 6):
            if (order > 1):
                filtered = ndimage.spline_filter(data, order=order)
            else:
                filtered = data
            tform_original = numpy.eye(2)
            offset_original = -numpy.ones((2, 1))
            tform_h1 = numpy.hstack((tform_original, offset_original))
            tform_h2 = numpy.vstack((tform_h1, [[0, 0, 1]]))
            out1 = ndimage.affine_transform(filtered, tform_original,
                                            offset_original.ravel(),
                                            order=order, prefilter=False)
            out2 = ndimage.affine_transform(filtered, tform_h1, order=order,
                                            prefilter=False)
            out3 = ndimage.affine_transform(filtered, tform_h2, order=order,
                                            prefilter=False)
            for out in [out1, out2, out3]:
                assert_array_almost_equal(out, [[0, 0, 0, 0],
                                                [0, 4, 1, 3],
                                                [0, 7, 6, 8]]) 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:27,代码来源:test_ndimage.py

示例3: save_spline_arrays

# 需要导入模块: from scipy import ndimage [as 别名]
# 或者: from scipy.ndimage import spline_filter [as 别名]
def save_spline_arrays(self, pickleName, what):
        if _DEBUG:
            print('. Pickling splines to\n{0}'.format(pickleName))
        splines = []
        for ia, a in enumerate(what):
            a = np.concatenate((a[:, self.extraRows:0:-1, :], a), axis=1)
            a = np.concatenate((a[:, :, self.extraRows:0:-1], a), axis=2)
            if self.order == 3:
                spline = ndimage.spline_filter(a)
            else:
                spline = a
            splines.append(spline)
        Imax = np.max(what[0])
        with open(pickleName, 'wb') as f:
            pickle.dump((Imax, splines), f, protocol=2)
        return splines, Imax 
开发者ID:kklmn,项目名称:xrt,代码行数:18,代码来源:sources_legacy.py

示例4: test_spline01

# 需要导入模块: from scipy import ndimage [as 别名]
# 或者: from scipy.ndimage import spline_filter [as 别名]
def test_spline01(self):
        for type in self.types:
            data = numpy.ones([], type)
            for order in range(2, 6):
                out = ndimage.spline_filter(data, order=order)
                assert_array_almost_equal(out, 1) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:8,代码来源:test_ndimage.py

示例5: test_spline02

# 需要导入模块: from scipy import ndimage [as 别名]
# 或者: from scipy.ndimage import spline_filter [as 别名]
def test_spline02(self):
        for type in self.types:
            data = numpy.array([1])
            for order in range(2, 6):
                out = ndimage.spline_filter(data, order=order)
                assert_array_almost_equal(out, [1]) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:8,代码来源:test_ndimage.py

示例6: test_spline03

# 需要导入模块: from scipy import ndimage [as 别名]
# 或者: from scipy.ndimage import spline_filter [as 别名]
def test_spline03(self):
        for type in self.types:
            data = numpy.ones([], type)
            for order in range(2, 6):
                out = ndimage.spline_filter(data, order,
                                            output=type)
                assert_array_almost_equal(out, 1) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:9,代码来源:test_ndimage.py

示例7: test_spline04

# 需要导入模块: from scipy import ndimage [as 别名]
# 或者: from scipy.ndimage import spline_filter [as 别名]
def test_spline04(self):
        for type in self.types:
            data = numpy.ones([4], type)
            for order in range(2, 6):
                out = ndimage.spline_filter(data, order)
                assert_array_almost_equal(out, [1, 1, 1, 1]) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:8,代码来源:test_ndimage.py

示例8: test_spline05

# 需要导入模块: from scipy import ndimage [as 别名]
# 或者: from scipy.ndimage import spline_filter [as 别名]
def test_spline05(self):
        for type in self.types:
            data = numpy.ones([4, 4], type)
            for order in range(2, 6):
                out = ndimage.spline_filter(data, order=order)
                assert_array_almost_equal(out, [[1, 1, 1, 1],
                                           [1, 1, 1, 1],
                                           [1, 1, 1, 1],
                                           [1, 1, 1, 1]]) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:11,代码来源:test_ndimage.py

示例9: test_shift09

# 需要导入模块: from scipy import ndimage [as 别名]
# 或者: from scipy.ndimage import spline_filter [as 别名]
def test_shift09(self):
        data = numpy.array([[4, 1, 3, 2],
                               [7, 6, 8, 5],
                               [3, 5, 3, 6]])
        for order in range(0, 6):
            if (order > 1):
                filtered = ndimage.spline_filter(data,
                                                           order=order)
            else:
                filtered = data
            out = ndimage.shift(filtered, [1, 1], order=order,
                                          prefilter=False)
            assert_array_almost_equal(out, [[0, 0, 0, 0],
                                       [0, 4, 1, 3],
                                       [0, 7, 6, 8]]) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:17,代码来源:test_ndimage.py

示例10: test_spline01

# 需要导入模块: from scipy import ndimage [as 别名]
# 或者: from scipy.ndimage import spline_filter [as 别名]
def test_spline01(self):
        for type_ in self.types:
            data = numpy.ones([], type_)
            for order in range(2, 6):
                out = ndimage.spline_filter(data, order=order)
                assert_array_almost_equal(out, 1) 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:8,代码来源:test_ndimage.py

示例11: test_spline02

# 需要导入模块: from scipy import ndimage [as 别名]
# 或者: from scipy.ndimage import spline_filter [as 别名]
def test_spline02(self):
        for type_ in self.types:
            data = numpy.array([1], type_)
            for order in range(2, 6):
                out = ndimage.spline_filter(data, order=order)
                assert_array_almost_equal(out, [1]) 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:8,代码来源:test_ndimage.py

示例12: test_spline03

# 需要导入模块: from scipy import ndimage [as 别名]
# 或者: from scipy.ndimage import spline_filter [as 别名]
def test_spline03(self):
        for type_ in self.types:
            data = numpy.ones([], type_)
            for order in range(2, 6):
                out = ndimage.spline_filter(data, order,
                                            output=type_)
                assert_array_almost_equal(out, 1) 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:9,代码来源:test_ndimage.py

示例13: test_spline04

# 需要导入模块: from scipy import ndimage [as 别名]
# 或者: from scipy.ndimage import spline_filter [as 别名]
def test_spline04(self):
        for type_ in self.types:
            data = numpy.ones([4], type_)
            for order in range(2, 6):
                out = ndimage.spline_filter(data, order)
                assert_array_almost_equal(out, [1, 1, 1, 1]) 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:8,代码来源:test_ndimage.py

示例14: test_spline05

# 需要导入模块: from scipy import ndimage [as 别名]
# 或者: from scipy.ndimage import spline_filter [as 别名]
def test_spline05(self):
        for type_ in self.types:
            data = numpy.ones([4, 4], type_)
            for order in range(2, 6):
                out = ndimage.spline_filter(data, order=order)
                assert_array_almost_equal(out, [[1, 1, 1, 1],
                                                [1, 1, 1, 1],
                                                [1, 1, 1, 1],
                                                [1, 1, 1, 1]]) 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:11,代码来源:test_ndimage.py

示例15: test_affine_transform09

# 需要导入模块: from scipy import ndimage [as 别名]
# 或者: from scipy.ndimage import spline_filter [as 别名]
def test_affine_transform09(self):
        data = numpy.array([[4, 1, 3, 2],
                            [7, 6, 8, 5],
                            [3, 5, 3, 6]])
        for order in range(0, 6):
            if (order > 1):
                filtered = ndimage.spline_filter(data, order=order)
            else:
                filtered = data
            out = ndimage.affine_transform(filtered, [[1, 0], [0, 1]],
                                           [-1, -1], order=order,
                                           prefilter=False)
            assert_array_almost_equal(out, [[0, 0, 0, 0],
                                            [0, 4, 1, 3],
                                            [0, 7, 6, 8]]) 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:17,代码来源:test_ndimage.py


注:本文中的scipy.ndimage.spline_filter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。