Project 4: A Wireless Tape Measure

The code in this section is going to introduce a new programming concept that I haven’t mentioned before and that might not be completely familiar to you from your previous work in Processing: accessing arrays of pixels. Specifically, we’ll be learning how to translate between a one-dimensional array of pixels and the two-dimensional image that it represents. I’ll explain how to do all of the calculations necessary to access the entry in the array that corresponds to any location in the image. And, more important, I’ll explain how to think about the relationship between the image and the array so that these calculations are intuitive and easy to remember.

At first, this discussion of pixels and arrays may feel ...

Get Making Things See now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.