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 and TV 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

  • 以鏡頭爲頂點,以被測目標的可通過鏡頭的最大範圍的兩條邊緣構成的夾角,稱爲視場角。 視場角的大小決定了視野範圍。視場角越大,視野就越大,目標物體超過這個角就不會被收在鏡頭裏。
    在這裏插入圖片描述
  • 一般情況下,視場角越大,焦距就越短。根據實際應用場景,選擇了視場角,焦距基本就確定了。
  • 最小視場角簡單確定:
    αmin=2×arctan(rd)\alpha_{min} = 2 \times arctan (\frac{r}{d})
    其中 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做圖像採集的, 但是並不能用於計算機, 只是嵌入式設備. 這裏是一些查到的資料:

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章