Chapter 2. Advanced Indexing and Array Concepts

In this chapter, we will cover:

  • Installing SciPy
  • Installing PIL
  • Resizing images
  • Comparing views and copies
  • Flipping Lena
  • Fancy indexing
  • Indexing with a list of locations
  • Indexing with booleans
  • Stride tricks for Sudoku
  • Broadcasting arrays

Introduction

NumPy is famous for its efficient arrays. This fame is partly due to the ease of indexing. We will demonstrate advanced indexing tricks using images. Before diving into indexing, we will install the necessary software— SciPy and PIL.

Note

The code for the recipes in this chapter can be found on the book website at http://www.packtpub.com. You can also visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Some of the examples in this chapter will involve manipulating images. In order to do that, we will require the Python Image Library (PIL) ; but don't worry, instructions and pointers to help you install PIL and other necessary Python software are given throughout the chapter, when necessary.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset