资源简介
这是一本基于python实现的BM3D去噪算法,值得学习一下

代码片段和文件信息
“““PyBM3D packaging and distribution.“““
import os
from setuptools import setup Extension
from setuptools.command.build_ext import build_ext as _build_ext
class CustomBuildExt(_build_ext):
“““Custom build extension class.“““
def __init__(self *args **kwargs):
“““Extends default class constructor.“““
# _build_ext is not a new-style (object) class which is required for
# super to work
_build_ext.__init__(self *args **kwargs)
self.cuda_config = self.load_cuda_config()
def build_extensions(self):
“““Extends default build_extensions method.
Further customizes the compiler to add C file specific compile
arguments and support nvcc compilation of *.cu CUDA files.“““
self.customize_compiler_for_c_args_and_nvcc()
_build_ext.build_extensions(self)
def finalize_options(self):
“““Extends default finalize_options method.
Injects NumPy‘s C include directories into the Cython compilation. This
is done after NumPy was installed through the setuptools setup_requires
argument which removes NumPy from the necessary preinstalled
packages.“““
_build_ext.finalize_options(self)
# prevent numpy from thinking it is still in its setup process
__builtins__.__NUMPY_SETUP__ = False
import numpy
self.include_dirs.append(numpy.get_include())
def customize_compiler_for_c_args_and_nvcc(self):
“““Customize the compiler.
The customization adds C file specific compile
arguments and support for nvcc compilation of *.cu CUDA files.“““
self.compiler.src_extensions.append(‘.cu‘)
# save references to the default compiler_so and _comple methods
default_compiler_so = self.compiler.compiler_so
super = self.compiler._compile
# now redefine the _compile method. This gets executed for each
# object but distutils doesn‘t have the ability to change compilers
# based on source extension: we add it.
def _compile(obj src ext cc_args extra_postargs pp_opts):
if os.path.splitext(src)[1] == ‘.cu‘:
# use the nvcc for *.cu files
self.compiler.set_executable(‘compiler_so‘
self.cuda_config[‘nvcc‘])
postargs = extra_postargs[‘nvcc‘]
else:
postargs = extra_postargs[‘unix‘]
# add C file specific compile arguments
if os.path.splitext(src)[1] == ‘.c‘:
postargs = postargs + extra_postargs[‘c_args‘]
super(obj src ext cc_args postargs pp_opts)
# reset the default compiler_so
self.compiler.compiler_so = default_compiler_so
# inject our redefined _compile method into the class
self.compiler._compile = _compile
@staticmethod
def load_cuda_config():
“““Locate the CUDA env
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-10-09 10:23 pybm3d-0.2.1\
文件 278 2017-10-09 10:23 pybm3d-0.2.1\.gitignore
文件 84 2017-10-09 10:23 pybm3d-0.2.1\.gitmodules
文件 139 2017-10-09 10:23 pybm3d-0.2.1\.scrutinizer.yml
文件 841 2017-10-09 10:23 pybm3d-0.2.1\.travis.yml
文件 35142 2017-10-09 10:23 pybm3d-0.2.1\LICENSE
文件 23 2017-10-09 10:23 pybm3d-0.2.1\MANIFEST.in
文件 3939 2017-10-09 10:23 pybm3d-0.2.1\README.rst
目录 0 2017-10-09 10:23 pybm3d-0.2.1\bm3d_src\
目录 0 2017-10-09 10:23 pybm3d-0.2.1\pybm3d\
文件 90 2017-10-09 10:23 pybm3d-0.2.1\pybm3d\__init__.py
文件 4594 2017-10-09 10:23 pybm3d-0.2.1\pybm3d\bm3d.pyx
文件 164 2017-10-09 10:23 pybm3d-0.2.1\setup.cfg
文件 6004 2017-10-09 10:23 pybm3d-0.2.1\setup.py
目录 0 2017-10-09 10:23 pybm3d-0.2.1\tests\
文件 2639 2017-10-09 10:23 pybm3d-0.2.1\tests\test_bm3d.py
文件 502 2017-10-09 10:23 pybm3d-0.2.1\tox.ini
相关资源
- 二级考试python试题12套(包括选择题和
- pywin32_python3.6_64位
- python+ selenium教程
- PycURL(Windows7/Win32)Python2.7安装包 P
- 英文原版-Scientific Computing with Python
- 7.图像风格迁移 基于深度学习 pyt
- 基于Python的学生管理系统
- A Byte of Python(简明Python教程)(第
- Python实例174946
- Python 人脸识别
- Python 人事管理系统
- 基于python-flask的个人博客系统
- 计算机视觉应用开发流程
- python 调用sftp断点续传文件
- python socket游戏
- 基于Python爬虫爬取天气预报信息
- python函数编程和讲解
- Python开发的个人博客
- 基于python的三层神经网络模型搭建
- python实现自动操作windows应用
- python人脸识别(opencv)
- python 绘图(方形、线条、圆形)
- python疫情卡UN管控
- python 连连看小游戏源码
- 基于PyQt5的视频播放器设计
- 一个简单的python爬虫
- csv文件行列转换python实现代码
- Python操作Mysql教程手册
- Python Machine Learning Case Studies
- python获取硬件信息
评论
共有 条评论