Numpy and Pillow




CS256

Chris Pollett

Oct 9, 2017

Outline

Introduction

Numpy

Importing and using Numpy

Array Creation and Assignment

Shape and Content of Numpy Arrays

Element Access

Operations on Arrays

Linear Algebra and Polynomials

Importing/Exporting to/from an Array

Quiz

Which of the following is true?

  1. We showed in class that there exists a polynomial time algorithm whose `n`-bit implementation as a preceptron network requires at least `Omega(n^2)` many distinct weights.
  2. Any boolean function can be mapped into a higher dimensional space S such that its 1 values can be separated from its 0 values by a hyperplane in S.
  3. A reduced convex hull for a convex hull has the same shape as that hull.

Pillow

Image Reading, Creation, Capturing

Image Manipulation With Pillow

Applying Operations to a Whole Image

Drawing to an Image

Getting Data, Mapping Image Data to Numpy, Writing Images