A computer vision project we’re working on has the goal of measuring objects in a 17-foot wide window with the camera mounted only 11 feet away. Using the Raspberry Pi V2 camera (Sony IMX219 sensor) with a horizontal field of view of 62.2 degrees isn’t wide enough – seeing only about 12.5 feet wide.
Typically you would add a wide angle lens. However, the Raspberry Pi fixed focus camera isn’t designed for an external lens, at least a lens mount isn’t part of the factory design.
How about adding an external lens like the ones sold for use with mobile phones?
The camera and lens need to meet these 3 requirements
- Measure objects in a 17-foot wide window from 11 feet away
- Return positional information from Aruco Markers in the image
- OCR handwritten digits from the images
We tested 3 lenses
- Generic Phone Camera Lens – $13.99
- Xenvo Pro Lens Kit – $39.99
- SANDMARC – WIDE LENS EDITION – $99.99
In this uncropped image from the Raspberry Pi camera, the outer Aruco Markers are at 16 feet. At 17 feet, the region of interest is covering about 82% of the horizontal camera sensor.
Generic Phone Camera Lens – $13.99
All 3 lenses provide roughly the same horizontal field of view. They are advertised as 120 degrees, .45X, double your field of view, etc. Not surprisingly, the Generic lens had the most barrel distortion, but worse, had such soft focus along the edges that OpenCV could not locate the outer Aruco makers. The center of the field of view was fine for this application, but the outer markers were useless.
Xenvo Pro Lens Kit – $39.99
The Xenvo produced much less barrel distortion than the $20 range lenses that were tested. Overall the image was sharper, but the edge distortion was still high. By doubling the size of the markers, OpenCV was able to locate them. This lens would have been acceptable for this application. (NOTE: This image was taken with the IR filter removed. The camera used the same Sony IMX219 sensor.)
SANDMARC – WIDE LENS EDITION – $99.99
The SANDMARC gave the best results. We also considered the Moment wide angle. However, the Moment has a custom mount requiring the purchase of a phone case for use with the lens.
The SANDMARC includes a case and a clip. Either of which can be modified for use with the Raspberry Pi camera.
With the higher price and the need to buy an additional case for the Moment, we went with the SANDMARC instead.
The barrel distortion is minimal with the SANDMARC. The smaller Aruco makers are decodable. The OCR target, when located on the right, where it will be placed in production, was clear and decodable.
Computer Vision and Machine Learning have never been more accessible to small businesses. If you’re considering a computer vision project for your business, we’d love to hear about it. Maybe we can design something incredible together.
Not surprising, the SANDMARC lens performed the best. If your project can afford it or needs the fidelity, it’s a good choice. We’ve chosen this lens for our project.
The Xenvo is a good choice if you need an image that is more attractive than the cheaper lens. If you don’t have high-resolution requirements for computer vision along the edges of the image, the lens performs well.
The generic lens would be fine in an application where resolution isn’t required. For example, if you simply need to detect motion in a wider field of view.