background preloader

Pythn

Facebook Twitter

Teaching. NumPy for Matlab Users - MATLAB® and !

NumPy for Matlab Users -

NumPy/! SciPy have a lot in common. But there are many differences. NumPy and SciPy were created to do numerical and scientific computing in the most natural way with Python, not to be MATLAB® clones. This page is intended to be a place to collect wisdom about the differences, mostly for the purpose of helping proficient MATLAB® users become proficient NumPy and SciPy users. Short answer Use arrays. They are the standard vector/matrix/tensor type of numpy. The only disadvantage of using the array type is that you will have to use dot instead of * to multiply (reduce) two tensors (scalar product, matrix vector multiplication etc.). Long answer Numpy contains both an array class and a matrix class. Operator *, dot(), and multiply(): For array, '*' means element-wise multiplication, and the dot() function is used for matrix multiplication.

There are pros and cons to using both: The table below gives rough equivalents for some common MATLAB® expressions. General Purpose Equivalents. OpenCV-Python Tutorials — OpenCV-Python Tutorials 1 documentation. Local Binary Pattern for texture classification — skimage v0.10dev docs. In this example, we will see how to classify textures based on LBP (Local Binary Pattern).

Local Binary Pattern for texture classification — skimage v0.10dev docs

LBP looks at points surrounding a central point and tests whether the surrounding points are greater than or less than the central point (i.e. gives a binary result). Before trying out LBP on an image, it helps to look at a schematic of LBPs. The below code is just used to plot the schematic. The figure above shows example results with black (or white) representing pixels that are less (or more) intense than the central pixel. When surrounding pixels are all black or all white, then that image region is flat (i.e. featureless). When using LBP to detect texture, you measure a collection of LBPs over an image patch and look at the distribution of these LBPs. The above plot highlights flat, edge-like, and corner-like regions of the image. The histogram of the LBP result is a good measure to classify textures. Python source code: download (generated using skimage 0.10dev) Canny edge detector — skimage v0.10dev docs.

The Canny filter is a multi-stage edge detector.

Canny edge detector — skimage v0.10dev docs

It uses a filter based on the derivative of a Gaussian in order to compute the intensity of the gradients.The Gaussian reduces the effect of noise present in the image. Then, potential edges are thinned down to 1-pixel curves by removing non-maximum pixels of the gradient magnitude. Finally, edge pixels are kept or removed using hysteresis thresholding on the gradient magnitude. OpenCV-Python.

Python Extension Packages for Windows - Christoph Gohlke. By Christoph Gohlke, Laboratory for Fluorescence Dynamics, University of California, Irvine.

Python Extension Packages for Windows - Christoph Gohlke

This page provides 32- and 64-bit Windows binaries of many scientific open-source extension packages for the official CPython distribution of the Python programming language. The files are unofficial (meaning: informal, unrecognized, personal, unsupported, no warranty, no liability, provided "as is") and made available for testing and evaluation purposes. If downloads fail reload this page, enable JavaScript, disable download managers, disable proxies, clear cache, and use Firefox. Please only download files manually as needed. Most binaries are built from source code found on PyPI or in the projects public revision control systems. Refer to the documentation of the individual packages for license restrictions and dependencies. Use pip version 8 or newer to install the downloaded .whl files. Install numpy+mkl before other packages that depend on it.

Build Environment. Python Extension Packages for Windows - Christoph Gohlke. By Christoph Gohlke, Laboratory for Fluorescence Dynamics, University of California, Irvine.

Python Extension Packages for Windows - Christoph Gohlke

This page provides 32- and 64-bit Windows binaries of many scientific open-source extension packages for the official CPython distribution of the Python programming language. The files are unofficial (meaning: informal, unrecognized, personal, unsupported) and made available for testing and evaluation purposes. If downloads fail reload this page, enable JavaScript, disable download managers, disable proxies, clear cache, and use Firefox. Please only download files as needed. Most binaries are built from source code found on PyPI or in the projects public revision control systems. Refer to the documentation of the individual packages for license restrictions and dependencies Many binaries depend on Numpy-MKL 1.8 and/or the Microsoft Visual C++ 2008 (64 bit or 32 bit, for CPython 2.6 to 3.2) or Visual C++ 2010 (64 bit or 32 bit, for CPython 3.3 and 3.4) redistributable packages. Build Environment.