Abstract

Reviewed by: Deborah Apthorp, University of New England, Australia; Australian National University, Australia
Some years ago, as a vision science Honours and then PhD student emerging from a Psychology degree (as many of us do), I had no programming experience at all when I started to run my experiments. This was before the days of PsychoPy, so I ran everything in MATLAB, first of all relying on my supervisor to program the experiments and then, over the years, teaching myself the necessary programming skills.
A new book by Marco Bertamini, ‘Programming Visual Illusions for Everyone’ (part of an ongoing series, ‘Vision, Illusion and Perception’, published by Springer), would have been invaluable to me back then, and perhaps I would now be fluent in Python instead of MATLAB. As I now supervise many undergraduate, Honours and PhD students, this book is of great interest to me as a potential teaching tool.
The book is available for 44.99 € ($A69.24) for the hardback edition (price in Australia) or 35.69 € ($A54.93) for the e-Book. To be honest, the price for the e-Book in particular is a little high, and I would recommend the publishers consider reducing this if they want academics to consider it for use as a course textbook. However, having said that, this is not out of keeping with the general high prices of academic textbooks.
Aside from this issue, the book does pretty much what the title suggests. It starts with a general introduction to visual illusions (Peirce, 2007), a general introduction to programming in Python, and an introduction to PsychoPy (for those who don’t know it, a free, open-source software package for Python specifically designed to present visual stimuli and experiments). The tone in the introductory chapters is a little jovial and condescending (‘Visual illusions are fun, and they are also very useful to understand visual perception’), as if the book is directed at early high school students, but this could be due to the author’s native language not being English. The upside of this is that he also avoids the jargon that visual perception researchers sometimes lapse into, so that the book is very readable by non-experts in perception.
After the first three introductory chapters, each chapter covers a particular visual illusion (some more famous than others), giving a background on the history of the illusion, what it shows about the visual system, and some comments from a contemporary researcher about it. These sections often divert into little asides with fascinating (if somewhat irrelevant) tidbits of knowledge. After the background, there are detailed instructions on how to program the illusion in PsychoPy, with clear explanations about what each section of code does. The code itself is downloadable from the companion website (https://www.programmingvisualillusionsforeveryone.online/), although Bertamini wisely recommends that the reader should type all the lines (an approach also recommended in Learn Python the Hard Way Shaw (2017) – one of the most highly recommended books on learning Python). At the end of each chapter is a small ‘extra challenge for extra fun’ exercise where the reader can extend what they have learned by tinkering with the code.
The chapters progress in a logical way from simple (the Kanisza square) to complex (Hierarchical Motion Organisation), introducing a new concept or skill in each chapter. For instance, we progress from learning about how to create a simple rating scale in Chapter 4 (the Kanisza Square) to complex geometrical calculations in Chapter 11 (the Honeycomb Illusion), through to calling out to collect responses from the mouse, and checking whether the cursor is inside a bounding box (Chapter 15, Hierarchical Motion Organisation). This progression should ensure that the concepts learned build on each other and that the learning curve is not too steep for students who are not experienced in programming.
I have run the code from each chapter and everything works beautifully.
In terms of the intended audience for this book, it would be particularly useful for a late undergraduate or early graduate class based around visual perception with a light emphasis on learning some programming skills along the way or for a class about programming where the instructor was looking for something engaging to keep the students interested. Probably the former would be more suitable, though, as programming courses tend to require a more formal approach to learning the structure of the language or principle being taught. As a secondary text to a Python programming course, it could be a great fun resource. The book is also very suitable for established vision scientists wishing to translate their existing code from another language (e.g. MATLAB, Presentation) into PsychoPy.
One notable omission that might be worth considering for the next edition is that there is no chapter on turning the illusion demonstrations into experiments. Each chapter includes some code for tinkering with various illusion parameters – changing the size or angles of various elements – via an interactive rating-scale-style slider, but there is no progression to turning the code into an experiment that can output data. I realise perhaps the intricacies of staircase designs and so on might be too much, but even a simple Method of Constant Stimuli experiment could be helpful on this front.
Overall, this book is a very welcome addition to the much-needed category of resources to assist in programming specific to vision science. Since PsychoPy is such an actively maintained and updated program, with newly developed capabilities to deploy online experiments, I imagine that new editions will be necessary across the years, but the presence of an active online resource should assist in keeping the content current.
