Raspberry Pi have updated the Raspberry Pi OS used on the single-board computer. One of the new features is that the Raspberry Pi camera libraries have been updated, now known as picamera 2.
This removes the need for the proprietary drivers. It now uses libcamera which is an open source camera library which can be interfaced with lots of other projects.
In this I’m going to provide an introduction to the new camera using a Raspberry Pi 3 and an official HQ (high quality) camera module. In my case the camera is attached to a microscope lens, but this will work the same whether you are using it with any of the different lenses that are available. It will also be the same for other Raspberry Pi cameras, although it’s the high quality camera that needs special consideration due to the memory usage – which I’ll explain later.
For this I’m using a free install of the latest version of Raspberry Pi OS. You can install this on older versions, but that involves more steps, particularly if you enabled legacy camera mode. I’d recommend a fresh install if possible.
I’m going to look at the example camera software, how to overcome the problem with the contiguous memory allocator and how to fix that.
I’ll then show how you can access the camera in your own code, using a simple python application which allows more convenient use of the camera.
For more details about the Microscope stand and lens see:
http://www.penguintutor.com/news/rasp...
For more details about the software created (including source code) see:
http://www.penguintutor.com/projects/...
Chapters:
00:00 Introduction to picamera2
01:35 Initial software setup and examples
04:23 Fixing unable to allocate buffers memory problem
06:00 Picamera2 GUI interface
08:42 Programming my own Python picamera2 app
13:16 Summary