USB工业摄像头模块选择

最近在挑选工业摄像头模块,查了一些资料,现在把简单的经验汇总下。非专业人士,只供基本参考。
主要挑选参数有:


1. 焦距

  • 可以根据下图选择焦距的大致范围。
  • 焦距在35-50mm的镜头都被看作标准镜头,更小焦距称为广角镜头,更大的则为远摄镜头。相同的拍摄距离,焦距长度增加一倍,则被摄体在画面中的大小也增大一倍,但视野缩小了。参考博文:镜头的焦距与视场角简介

2. 帧率 FPS

  • 可以根据实际需求来选择,一般视频场景都是在24-30FPS,远远高于30则表示视频将更流畅,更逼真。
  • 在捕捉动态视频内容时,帧率越高越好,但相机传输和处理的数据量将会增大。
  • 帧率会随着光照等环境变换而变换,并不是固定的,规格参数上说的是最大帧率。

参考: https://www.onlinemictest.com/webcam-test/
FPS is the number of frames, or images, that your webcam is taking and transmitting every second. This number is affected by the type of webcam that you have, and also by the speed of your computer and the number of tasks that it is engaged in at a given moment…

FPS matters because the higher this nubmer is the more life-like and real the resulting video looks. We are used to seeing movies in the cinema a*** shows displayed at around 24-30 FPS. Generally the FPS of television is higher than that of the cinema.

So if, let’s say, you’re using Skype and the FPS your camera is recording is lower than 24, then that means that the image is going to look a little stuttery to the other side.

A number significantly higher than 30, meanwhile, just means that the video will be more fluid, more lifelike. This fluidity might seem a little odd to our eyes which are accustomed to 24-30 FPS, but generally a higher FPS count is a good thing. It will just look a little less “cinematic”, and a little more “daily soap opera”.

3. 视场角 FOV

  • 以镜头为顶点,以被测目标的可通过镜头的最大范围的两条边缘构成的夹角,称为视场角。 视场角的大小决定了视野范围。视场角越大,视野就越大,目标物体超过这个角就不会被收在镜头里。
  • 一般情况下,视场角越大,焦距就越短。根据实际应用场景,选择了视场角,焦距基本就确定了。
  • 最小视场角简单确定:
    α m i n = 2 × a r c t a n ( r d ) \alpha_{min} = 2 \times arctan (\frac{r}{d}) αmin=2×arctan(dr)
    其中 d 是最小监控距离, r是所需视野的最大半径. (非专业称呼)

4. 分辨率

  • 需确定最大分辨率和默认分辨率,可以用opencv确定,也可以直接在线检测: Webcam Resolution Test
  • 需要注意有些镜头的高分辨率是插值得到
  • 分辨率设置只能是支持的分辨率或按比例缩小
    • 4: 3 的分辨率有:
      160x120, (176x144), 320x240, (352x288), 640x480, 800x600, 960x720, 1024x768, 1280x960, 1600x1200
    • 16:9的分辨率有:
      640x360, 960x540, 1280x720, 1920x1080, 3840x2160
  • 分辨率调整代码
#include <iostream>
#include "opencv2/highgui/highgui.hpp"

using namespace std;

int main(int argc, char* argv[])
{
    cv::VideoCapture cap;
    cap.open(0);    // 打开摄像头
    if(!cap.isOpened())
    {
        cerr << "Couldn't open capture." << endl;
        return -1;
    }
    cv::namedWindow("Camera", cv::WINDOW_AUTOSIZE);
    // 查看默认分辨率
    int width = (int)cap.get(cv::CAP_PROP_FRAME_WIDTH);
    int height = (int)cap.get(cv::CAP_PROP_FRAME_HEIGHT);
    cout << "镜头默认分辨率为: ("
        << width << "," << height << ")" << endl;
    // 查看最大分辨率
    cap.set(cv::CAP_PROP_FRAME_WIDTH, 100000.0);
    cap.set(cv::CAP_PROP_FRAME_HEIGHT, 100000.0);
    width = (int)cap.get(cv::CAP_PROP_FRAME_WIDTH);
    height = (int)cap.get(cv::CAP_PROP_FRAME_HEIGHT);
    cout << "镜头最大分辨率为: ("
        << width << "," << height << ")" << endl;
    // 设置选定的分辨率
    cap.set(cv::CAP_PROP_FRAME_WIDTH, 1280.0);
    cap.set(cv::CAP_PROP_FRAME_HEIGHT, 720.0);
    width = (int)cap.get(cv::CAP_PROP_FRAME_WIDTH);
    height = (int)cap.get(cv::CAP_PROP_FRAME_HEIGHT);
    cout << "镜头分辨率更改为: ("
        << width << "," << height << ")" << endl;
    // 显示输出, 按ESC键退出
    cv::Mat frame;
    while(1)
    {
        cap >> frame;
        cv::imshow("Camera", frame);
        char key = cv::waitKey(33);
        if(key == 27)
            break;
    }
    return 0;
}

5. 参数测试

  • 第4节中已经提到, 网址是 Webcam Test
  • 可测试项目:
    Check Webcam 参数检测
    Detect Resolution 支持的分辨率检测

6. 镜头畸变问题

在网上查了几家的摄像头, 除了上述提到的主要参数, 还有镜头畸变问题. 一般超过120度就会有畸变, 如图所示.
暂时没有镜头标定的经验, 而且对近距离监控项目来说, 80度的视野已经够用, 所以采买的是100度无畸变镜头.

7. 光源

暂时叠加一层补光灯板, 店铺一般提供, 白光亮度可调, 到货后会尝试效果, 预期是去除阴影

其他

最初是打算用openmv做图像采集的, 但是并不能用于计算机, 只是嵌入式设备. 这里是一些查到的资料:

全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务