资源简介
这是一本基于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实现SGBM图像匹配算法
- python实现灰度直方图均衡化
- scrapy_qunar_one
- Python学习全系列教程永久可用
- python简明教程.chm
- 抽奖大转盘python的图形化界面
- 双边滤波器实验报告及代码python
- python +MYSQL+HTML实现21蛋糕网上商城
- Python-直播答题助手自动检测出题搜索
- OpenCV入门教程+OpenCV官方教程中文版
- Python 串口工具源码+.exe文件
- Python开发的全栈股票系统.zip
- Python操作Excel表格并将其中部分数据写
- python书籍 PDF
- 利用python绘制散点图
- python+labview+No1.vi
- 老男孩python项目实战
- python源码制作whl文件.rar
- python3.5可用的scipy
- PYTHON3 经典50案例.pptx
- 计算机科学导论-python.pdf
- python模拟鼠标点击屏幕
- windows鼠标自动点击py脚本
- 鱼c小甲鱼零基础学python全套课后题和
- Python 练习题100道
- Practical Programming 2nd Edition
- wxPython Application Development Cookbook
- python 3.6
- Python 3.5.2 中文文档 互联网唯一CHM版本
- python3.5.2.chm官方文档
评论
共有 条评论