M12 Lenses for a Raspberry Pi High Quality Video Conferencing Camera
Max Henkart - November 26, 2020
A few early users of our lenses are actively involved in the RPi community and mentioned the products in a thread. And many people were curious "well what lens should I use?"
This post should address these questions! This is a DIY hacky post I made during WFH in Covid. My professional optical engineering and camera design efforts are more comprehensive.
About Me (Max): I'm a freelance optical engineering and camera design consultant. I've been through several startups through the pre-seed days. I've been project based with a few Series A to Series D companies on their camera HW. I worked for a major US/Chinese lens manufacturer for 5 years. If you drive a US or European vehicle, you're likely driving around with several camera lenses from the company.
I'll show you the camera hardware and most importantly: the output images.
There are five sections to this post. Click below to skip forward to what you're interested in:
- A Preface about Professional 4K Video Conferencing Cameras.
- A Review of The Raspberry Pi High Quality 6mm Lens.
- The Commonlands M12 Lens Options and FoV Comparison Testing.
- A 4 Stage "How-To" on lens/accessory selection, and professionally focusing the HW.
Disclaimer: I am not a model and I did this at home.
The Preface about 4K+ Video Conferencing Cameras
Video conferencing applications vary widely. There are end-of-room huddle screens, lecture-style meeting rooms, executive board rooms, and personal desktops. Each situation has different field of view (FoV) requirements, resolution, and price point. Now that Zoom, etc. have been widely adopted, we'll see how things shape up.
Here's some free market research on the 4K+ compatible video conferencing products on the market - up to date as of Nov 2020. This should give you a sense of the FoV which the PMs at large companies select.
The closest models to a consumer webcam were chosen for the below report.
|Company Name||Product||Use-case||Price||HFoV||Effective Resolution*|
|Cisco||None||Lecture Room||N/A||95°||1080p Zoom|
|Dolby||Room||Small Office||~$1k||95°||12MP 4K+|
|LifeSize||Icon 300||Small Office||$1.5k||113°||12MP (4K)|
|Logitech||Brio Ultra||Home||$199||82°||12MP 4K+|
|Owl Labs||Meeting Pro||Home +
|Polycom||EagleEyeCube||Small Office||$750+||110°||12MP 4K+|
* Not all cameras use every pixel on the sensor. Down-sampling due to de-warping has been included in the metric shown in parentheses. Absolute angular resolution (#px across a persons face on the horizon) and parallax has been factored in.
The Raspberry Pi HQ Off-The-Shelf 6mm Lens
Here's an output from the standard Raspberry Pi 6mm CS lens. As a starter lens it works, but the optics team over at RPi missed the distortion problem entirely. Maybe they said good-enough cheap-enough.
Either way, they decided to retail an underperforming lens that explicitly says "3MP" as their primary 12MP "High Quality" lens. I barely get 720p equivalent resolution when I run a proper ISO 12233:2014 eSFR measurement with this lens. Definitely not High Quality. Read our blog post about resolution for more insight into the types of resolution.
Notice how the ceiling curves?
The Commonlands M12 Lens Options
Our 4K+ lenses for video conferencing with the the RaspberryPi are below. All of these lenses have <2% distortion which is greatly improved relative to the 6mm Raspberry Pi CS mount lens:
CIL028: a 2.8mm F/2.4 lens with 96° Horizontal Field of View.
CIL033: a 3.3mm F/2.6 lens with 88° Horizontal Field of View. Not Shown.
CIL039: a 3.9mm F/2.4 lens with 77° Horizontal Field of View.
CIL042: a 4.2mm F/2.8 lens with 72° Horizontal Field of View.
CIL060: a 6.0mm F/2.4 lens with 55° Horizontal Field of View.
The Field of View Output Comparison
Here is what each of the lenses looks like in a webcam setting. These were taken in the full resolution still image mode with the default settings. To get the perfect image, I'd recommend messing around with the Auto-White Balance and Auto Exposure settings of your camera.
Not worthy of Science Magazine. But it'll cut it for a DIY project. A white wall behind you and ring lighting makes Zoom video quality way better. I skipped these steps so that you can visualize the performance better. The curtains and windows are 10' behind where I'm sitting.
The Camera Hardware Walk-Through
Step 1: Figure out where you want to position your video conferencing camera.
Positioning is key to field of view selection. A laptop camera 1' from where you are sitting requires a completely different lens than if you are sitting 3' away from your battle-station.
We've provided an Angle of View calculator that is free to use here. You can use this to calculate the AoV/FoV you need from your scene geometry. My personal preference is to have my face occupy about 30%-35% of field of view.
Step 2: Purchase a Lens (or Two) and Accessories.
Here you are. Make the FoV decision.
Scroll back up to the competitive research chart and the comparison images. It may help you decide what field of view you want to target. There are additional output images from each lens on the lens page. You can also check the mechanical profile and detailed specs on the pages.
Regardless of what you choose, an M12 lens on the RPi HQ will probably look something like this. Then you can 3D print or laser cut a housing accordingly.
The Adapter Talk
If you're using an M12 lens, make sure to get an M12-to-CS adapter. We don't care where, but it's needed.
It's also great to get something that let's you lock the focus reliably. That's why our CS to M12 mount adapters come with a focus lock ring. These two pieces enable you to fix the position of an M12 lens within a CS or C mount, without any Teflon tape or adhesive.
I know the cheap adapters on Amazon are tempting. Yes, Arducam has been known to put a screen print on these and retail them. Go ahead and try them if you want.
Personally, I've bought from several different vendors on Amazon, including 30+ from a vendor who has now delisted because of quality problems and cost over-runs. Every unit went in the trash because the 1"-32TPI thread spec didn't pass a Go-NoGo gauge - the thread pitch was incorrect. When Amazon receives this many complaints from customers, you know its a problem. The adapters barely made a single full rotation into the Raspberry Pi HQ mount...
A Side-Bar about M12 Lenses: They Usually Outperform C and CS mount lenses.
Many people think that "More Glass is Better Glass" where in fact the exact opposite can be true.. It has to do with the fact that the C, CS, EF, F, and PL mount systems were developed for CCDs in the 1900's. There are artificial optical design constraints that substantially reduce the MTF.
We're well into the 2000's now and CMOS technology has advanced rapidly.
Interchangeable C and CS mounts are fine for 1"+ sensors that have a huge (>3 micron) pixel pitch. So, they were popular until 2013 when Sony released the 20MP 1" IMX183. They remain popular in the surveillance and machine vision industries because of their ease-of-use. In these industries, the pixel sizes are still fairly large, and people want to easily swap lenses.
Let's take the iPhone 12 and iPhone 12 Pro cameras for case and point that less glass can achieve pretty good image quality. A Sony Alpha full-frame mirrorless cameras destroy Canon full-frame DSLR cameras on every image quality benchmark possible - there is no back focal length restriction on the optical design.
Step 3: Create a Focus Chart
This hacky step of the project will get you the most bang for your buck. Especially if you are trying to fiddle with the lens all the time. Companies like Apple spend $500k+ for a single AA machine to get this step right. You can get 50% of the way there for under $1.
Get a cardboard box that's pretty flat. Breaking down an old Amazon box works.
Download and Print Siemens Star Chart. I'd suggest a Sinusoidal one as it's ISO12233 compliant if printed professionally.
Once you've printed out the chart, you can cut the box to size. I find that leaving one of the flaps open is a convenient way to create a triangular base.
Tape down the chart in the corners and centers. Fold the bottom flap into a triangle (if you left it) and tape to the back side of the box.
Now you have a focus target which is better than what dozens of camera manufacturers use.
Set up your camera in the location you want to use it for video conferencing. I'd keep this as 'in-situ' as possible - make the focus set up representative of your real use case set up.
Now, put your single target in the location of where your head will be located. You may need to set up boxes or tripods to get the Focus Chart into the correct position. You'll want the Focus Chart to be normal to the camera.
Illumination is important and an easy way to improve the appearance of your video. Light rings are the cheapest and easiest thing for video conferencing. Pick one up on Amazon as the cheap ones are <$10.
This is a cheap, fast, and effective way to optimize the image quality across your face in the video. This single point focus method is not what I would recommend in a manufacturing environment.
If you are selling cameras to others or using them in a commercial project, I'd go with a field weighted approach. You can read our How to Focus a Camera post for more details. If you have questions about camera module assembly in production, please reach out.
Step 5: Get the SW/FW running and start conferencing!
If you've kept your Raspberry Pi HQ intact with it's absorptive blue glass IR cut off filter, then you're all ready to go. You can tweak various settings to improve the image quality.
If you've modified the Raspberry Pi HQ (removed the IR cut off filter or have NOIR version) there will be image quality settings which need to be tweaked. In a professional scenario, this is called Image Quality Tuning and includes tuning the 3As (Auto-White Balance, Auto-Exposure, Auto-Focus) Tuning. For this fixed focus project, it would only be 2A's.
At this point, I'll hand the project back on over to you. If you need another walkthrough with FW/SW guidance, check out the ShowMeWebcam (Hackaday) Project. Feel free to contact me at (firstname.lastname@example.org) if you have any feedback or questions.
You can make a pretty good 4K webcam using the Raspberry Pi High Quality camera. It'll outperform most of the cheap 1080p Logitech cameras on the market. And, you can customize the Field of View precisely to your set up.