An overview of RaspberryPi cameras
RPi is one of the most interesting SBCs for small, self-contained image recognition applications. In this post, I will explain why I think this is the case and present an overview of cameras I have tested on RPis.
RPi is not the only SBC around. Some of them are cheaper. Some of them are more powerful. Many of them are advertised as having "camera connector" which may lead you to believe that adding MIPI/CSI camera module should be trivial. Unfortunately, that is not the case. It is not enough that SBC has a group of pins broken out to a single flat-flex cable connector.
First of all, you want to be able to purchase the camera module compatible with your board. If you think you can spin a PCB for image sensor (it's a simple breakout board, how hard could it be): it's not easy at all. Relatively modern image sensors are hard to source in small quantities. And if you can source them, it's tough to even get documentation for them.
Second, software support. Modern image sensors are complex beasts. If there is no software support for the sensor on your SBC- tough times. Even though image-data link is relatively standard MIPI/CSI (so, common for all image sensors on SoC platform) each image sensor needs to be set up with correct parameters before it outputs anything. Some even have embedded microcontrollers which need firmware (blob from sensor's manufacturer).
If the sensor electrical datasheet was hard to get: getting access to detailed documentation of sensor's registers is even harder (Android driver sources are usually very good source of this information). Besides, it's not enough to set up the sensor for desired capture mode. For best results you want to have calibration/tuning parameters for lot's of details: color correction, automatic exposure control, lens correction etc.
None of the hobbyist single-board computers have camera modules that come close to RPi in terms of quality and ease of use. BananaPi camera module seems to work, but the image quality was pretty bad, the support for hardware video encoding was not there the last time I checked.
RaspberryPi Camera V2
This is the second version of original RaspberryPi camera board: it has an 8MP Sony IMX219 image sensor. If you want pretty pictures from your Pi- this is the camera to buy. It's interesting to note that RaspberryPi foundation have added crypto IC to authenticate modules manufactured by RaspberryPi foundation.
RaspberryPi Camera V1
The original camera module with 5MP OV5647 image sensor. Although a bit dated, this sensor still offers reasonable quality. Physically looks very much like v2 cameras.
Both v1 and v2 cameras can be modified for M12 mounts. However, this solution gives subpar image quality because image sensor is not rigidly attached to PCB so the sensor and lens are not guaranteed to be aligned correctly.
OV5647-based camera modules by third party manufacturers
There are sellers on eBay and Aliexpress that sell "RaspberryPi compatible camera modules".
These cameras are clones of RaspberyPi camera v1. However, many of them are not direct clones: they use image sensor in different package and what is much more important: the lens on these modules can be easily swapped if you need different viewing angle.
ArduCam is a Chinese company which has developed and sell good quality RPi camera modules. The lens mount options are exceptional: they even have a module with CS mount! This company also seems to be the only place to get IMX219-based camera module with M12 and CS mount options, although I've heard the price is a bit on the high side ($50+).
The only other options remain USB and Ethernet (GigE) cameras. These tend to be pricey (with retail prices starting from $200 for USB cameras and $400 for GigE).
Although the Pi does not have gigabit ethernet, GigE cameras usually work in 100Mbit mode (obviously, the framerate could be limited). However, if you're going on this route, I would recommend ODroid XU4 which I have tested with GigE camera.
I have not had much experience with USB based machine vision cameras so I'd like to hear your opinions/experience!