1.SciPy和Numpy的处理能力

numpy的处理能力包括:

  • a powerful N-dimensional array object N维数组;
  • advanced array slicing methods (to select array elements);N维数组的分片方法;
  • convenient array reshaping methods;N维数组的变形方法;

and it even contains 3 libraries with numerical routines:

  • basic linear algebra functions;基本线性代数函数;
  • basic Fourier transforms;基本傅立叶变换;
  • sophisticated random number capabilities;精巧的随机数生成能力;

scipy是科学和工程计算工具。包括处理多维数组,多维数组可以是向量、矩阵、图形(图形图像是像素的二维数组)、表格(一个表格是一个二维数组);目前能处理的对象有:

  • statistics;统计学;
  • numeric integration;数值积分;
  • special functions;特殊函数;
  • integration, ordinarydifferential equation (ODE) solvers;积分和解常微分方程;
  • gradient optimization;梯度优化;
  • geneticalgorithms;遗传算法;
  • parallel programming tools(an expression-to-C++ compilerfor fast execution, and others);并行编程工具;

在将来会增加下面的计算处理能力(现在已经部分地具备了这些能力):

  • Circuit Analysis (wrapper around Spice?);电路分析;
  • Micro-Electro Mechanical Systems simulators (MEMs);
  • Medical image processing;医学图像处理;
  • Neural networks;神经网络;
  • 3-D Visualization via VTK;3D可视化;
  • Financial analysis;金融分析;
  • Economic analysis;经济分析;
  • Hidden Markov Models;隐藏马尔科夫模型;

2.处理图像 翻译链接:http://reverland.org/python/2012/11/12/numpyscipy/

原始链接:http://scipy-lectures.github.io/advanced/image_processing/index.html

特征提取和分形:

边缘检测

合成数据:

>>> im = np.zeros((256, 256))
>>> im[64:-64, 64:-64] = 1
>>>
>>> im = ndimage.rotate(im, 15, mode='constant')
>>> im = ndimage.gaussian_filter(im, 8)

使用_梯度操作(Sobel)_来找到搞强度的变化:

>>> sx = ndimage.sobel(im, axis=0, mode='constant')
>>> sy = ndimage.sobel(im, axis=1, mode='constant')
>>> sob = np.hypot(sx, sy)

示例源码

canny滤镜

Canny滤镜可以从skimage中获取(文档),但是为了方便我们在这个教程中作为一个_单独模块_导入:

>>> #from skimage.filter import canny
>>> #or use module shipped with tutorial
>>> im += 0.1*np.random.random(im.shape)
>>> edges = canny(im, 1, 0.4, 0.2) # not enough smoothing
>>> edges = canny(im, 3, 0.3, 0.2) # better parameters

示例源码

需要调整几个参数……过度拟合的风险

分割

  • 基于_直方图_的分割(没有空间信息)

      >>> n = 10
    >>> l = 256
    >>> im = np.zeros((l, l))
    >>> np.random.seed(1)
    >>> points = l*np.random.random((2, n**2))
    >>> im[(points[0]).astype(np.int), (points[1]).astype(np.int)] = 1
    >>> im = ndimage.gaussian_filter(im, sigma=l/(4.*n)) >>> mask = (im > im.mean()).astype(np.float)
    >>> mask += 0.1 * im
    >>> img = mask + 0.2*np.random.randn(*mask.shape) >>> hist, bin_edges = np.histogram(img, bins=60)
    >>> bin_centers = 0.5*(bin_edges[:-1] + bin_edges[1:]) >>> binary_img = img > 0.5

SciPy和Numpy处理能力的更多相关文章

  1. Windows下安装Scipy和Numpy失败的解决方案

    使用 pip 安装 Scipy 库时,经常会遇到安装失败的问题 pip install numpy pip install scipy 后来网上搜寻了一番才得以解决.scipy 库需要依赖 numpy ...

  2. Scipy和Numpy的插值对比

    技术背景 插值法在图像处理和信号处理.科学计算等领域中是非常常用的一项技术.不同的插值函数,可以根据给定的数据点构造出来一系列的分段函数.这一点有别于函数拟合,函数拟合一般是指用一个给定形式的连续函数 ...

  3. Windows下python virtualenv使用,镜像源设置,批量安装,安装scipy,numpy

    镜像源设置 在C:\Users\Administrator\下建立pip文件夹,然后在里面创建了一个pip.ini 内容为: [global]index-url = https://pypi.tuna ...

  4. python(5):scipy之numpy介绍

    python 的scipy 下面的三大库: numpy, matplotlib, pandas scipy 下面还有linalg 等 scipy 中的数据结构主要有三种: ndarray(n维数组), ...

  5. [Python] Scipy and Numpy(1)

    import numpy as np #Create an array of 1*10^7 elements arr = np.arange(1e7) #Converting ndarray to l ...

  6. windows下安装python科学计算环境,numpy scipy scikit ,matplotlib等

    安装matplotlib: pip install matplotlib 背景: 目的:要用Python下的DBSCAN聚类算法. scikit-learn 是一个基于SciPy和Numpy的开源机器 ...

  7. Python下科学计算包numpy和SciPy的安装

    转载自:http://blog.sina.com.cn/s/blog_62dfdc740101aoo6.html Python下大多数工具包的安装都很简单,只需要执行 “python setup.py ...

  8. python数值计算模块NumPy scipy安装

    NumPy为Python提供了快速的多维数组处理的能力,而SciPy则在NumPy基础上添加了众多的科学计算所需的各种工具包,有了这两个库,Python就有几乎和Matlab一样的处理数据和计算的能力 ...

  9. [笔记]我的Linux入门之路 - 05.Eclipse的Python开发环境搭建与Numpy、Scipy库安装

    一.Python环境 直接终端查询下python安装没:python --version Python 2.7.12 Ubuntu竟然已经装了Python2.7,那就好说了.不然自己装和装jdk差不多 ...

随机推荐

  1. Tost元素识别

    在日常使用App过程中,经常会看到App界面有一些弹窗提示(如下图所示)这些提示元素出现后等待3秒左右就会自动消失,那么我们该如何获取这些元素文字内容呢? Toast简介 Android中的Toast ...

  2. Jquery向页面append新元素之后,如何解决事件的绑定问题?

    今天有get到一个新知识点,就是当我们向页面添加新的元素之后,加载之前的函数方法就对新元素失效了,下面我来说说如何解决这个问题的? 我先看jq api文档没有找到方法,无果只好到网上找些资料,果然找到 ...

  3. #MySQL数据库无法远程访问的问题

    在 Ubuntu上装了mysql,因为项目的数据库是mysql,将项目放在tomcat里面webapp下面,一直启动不成功.本来一直以为是jdbc驱动问题,后来发现不是. 感谢!!http://blo ...

  4. 【习题 4-2 Uva201】Squares

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 注意那个星号的数量... 然后V x y的话,是从(y,x)向(y+1,x)连线. H x y才是从(x,y)向(x,y+1)连线 ...

  5. Mysql学习总结(38)——21条MySql性能优化经验

    今天,数据库的操作越来越成为整个应用的性能瓶颈了,这点对于Web应用尤其明显.关于数据库的性能,这并不只是DBA才需要担心的事,而这更是我们程序员需要去关注的事情. 当我们去设计数据库表结构,对操作数 ...

  6. POJ 1694 An Old Stone Game

    题目: Description There is an old stone game, played on an arbitrary general tree T. The goal is to pu ...

  7. Summary of Memory Management Methods

    Summary of Memory Management Methods Table 18-1 summarizes the various memory management methods. If ...

  8. oracle 工具:tkprof

    https://docs.oracle.com/cd/B10501_01/server.920/a96533/ex_plan.htm http://blog.csdn.net/dba_waterbin ...

  9. VS-诊断工具和智能跟踪

    MSDN文章

  10. SVN提示被锁定的解决方法(转)

    1.(常用)出现这个问题后使用“清理”即"Clean up"功能,如果还不行,就直接到上一级目录,再执行“清理”,然后再“更新”. 2.(没试过)有时候如果看到某个包里面的文件夹没 ...