{
 "metadata": {
  "name": "Welcome to IPython Notebook"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "#Introduction\n",
      "\n",
      "IPython Notebook lets you work interactively with snippets of Python code. This distribution for the Mac comes with many popular scientific/mathematical extension modules. Below are some examples of what you can do with it.\n",
      "\n",
      "To close this example notebook and get back to the notebook overview, hit \u2318-W (Close) or click the logo at the top left.\n",
      "\n",
      "More information about IPython Notebook is at at http://ipython.org/notebook.html. More information about and the latest version of this Mac distribution are at http://github.com/liyanage/ipython-notebook/.\n",
      "\n",
      "## A Note About Sandboxing\n",
      "\n",
      "This application is sandboxed, and if you want to access files and folders outside the notebooks folder you selected, you have to give the application access to those locations in the Preferences.\n",
      "\n",
      "If you just need a space for temporary files, you can use the folder given by the TMPDIR environment variable:\n",
      "\n",
      "    path = os.path.join(os.environ['TMPDIR'], 'out.txt')"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "#Some Examples\n",
      "\n",
      "To run each of these examples, click into the cell with the code and hit Shift-Return to execute it."
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "## Pure Python\n",
      "\n",
      "Just plain Python code."
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "print \"Hello World\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "## Matplotlib\n",
      "\n",
      "Used for plotting and graphing. More information at http://matplotlib.org/contents.html."
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from pylab import *\n",
      "X = np.linspace(-np.pi, np.pi, 256,endpoint=True)\n",
      "C,S = np.cos(X), np.sin(X)\n",
      "plot(X,C)\n",
      "plot(X,S)\n",
      "\n",
      "show()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "## OpenCV\n",
      "\n",
      "OpenCV is used for computer vision applications. More information at http://opencv.org."
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Based on sample code from\n",
      "# \"Programming Computer Vision with Python\": http://programmingcomputervision.com\n",
      "\n",
      "import os\n",
      "import cv2\n",
      "from IPython.core.display import Image \n",
      "\n",
      "im1 = cv2.imread('/Library/Desktop Pictures/Snow.jpg')\n",
      "\n",
      "im_lowres = cv2.pyrDown(cv2.pyrDown(im1))\n",
      "gray = cv2.cvtColor(im_lowres, cv2.COLOR_RGB2GRAY)\n",
      "\n",
      "s = cv2.SURF(30)\n",
      "keypoints = s.detect(gray, None)\n",
      "\n",
      "for k in keypoints[::10]:\n",
      "    cv2.circle(im_lowres, (int(k.pt[0]), int(k.pt[1])), 1, (0,180,0), 2)\n",
      "    cv2.circle(im_lowres, (int(k.pt[0]), int(k.pt[1])), int(k.size), (0,180,0), 1)\n",
      "\n",
      "outpath = os.path.join(os.environ['TMPDIR'], 'out.png')\n",
      "cv2.imwrite(outpath, im_lowres)\n",
      "Image(filename=outpath)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}