【工业相机】【深度1】相机的选择:- 镜头- 详细例子

本文论三个问题

1 如何依据应用选传感器型号和分辨率

 分辨率从来都不是独立,他和MFT曲线的对比度有重要联系

2 如何选择需要的最好的相机和镜头、

由于镜头是工业产品,肯定没有完全适合的镜头,这时候,进行选择就需要进行适当的调整和取舍。

3 如何找到满足的适合的亮度的可靠性性能

4 工业相机选型举例

我们用Computar 的 M0814-MP2 来做举例

这个镜头的详细参数如上:

【Franklin案】在搭配机器视觉方案的时候,主要从三个方面考虑,1 相机的传感器 2 镜头 3 被测物体。

从这三个角度看,每一个都有很多参数需要考虑,我们关注这三个量的匹配程度即可。主要参数归结如下:


1 相机传感器选择:

  • 应用场景选择

    我们是测量物体大小、分辨物体,是拍清楚还是拍全,是拍静态还是动态,是白天还是夜晚等等。
  • 精度需求

    • 最佳FOV
      • 设计最小满足需求的FOV,FOV越小,精度越高
      • 【Franklin案:FOV和测试距离精度往往为相冲突的两个需求】
    • 最佳工作距离
      • 工作距离和零件精度的百分比
    • 精确度需要
    • 是否单目
    • 更多需求
    • 需要10倍的精度大于需求精度
  • 彩色黑白

  • 速度

  • 环境

  • 线扫还是面扫


2 镜头选择

上图为镜头主要参数表达:

镜头的可选参数:

 2.1 1. 工作波长

视觉系统通常使用环境是在可见光范围内,这样的镜头是我们最常用的,也有一些系统比较特殊,使用环境是在紫外或者红外波段,需要选用专门的紫外或者红外镜头。

2.1.2 变焦与定焦

大多数视觉系统的工作距离和放大倍数是不变的,因此镜头焦距也是固定的,但部分系统需要在工作距离变化后保持放大倍数稳定,或者在工作距离不变的情况下获得不同的放大倍数,这样我们需要选用变焦镜头。

2.1.3 远心镜头与标准工业镜头


对于精密测量的系统,需要选用远心镜头,它的特点是:物体在景深范围内移动,光学放大倍数不变这就避免了测试过程中工作距离的轻微改变导致系统放大倍数的变化,保证了系统规定测量精度。
对于一般的工业测量、缺陷检测或者定位等,对物体成像的放大倍率没有严格要求,只要选用畸变小的镜头,就可以满足要求。

2.1.4 靶面大小与分辨率的基本原则

镜头成像面大小必须大于与之配套的CCD相机的靶面,这样CCD相机的芯片才能得到充分的利用。

镜头的选择要考虑其分辨率要与相机的像元大小等匹配,这样设计的系统能充分利用CCD相机的分辨精度,还能使系统的经济性达到最佳。

2.1.5 视场角与焦距

通过系统要求的视场角可以找到对应焦距的镜头,而通过系统提供的分辨率和相机的像元等参数,可以利用基本的几何光学原理计算出合适的系统焦距。

 上式子,计算的,要 拍摄全部的幅宽的物体,需要的焦距:

标识输入参数举例
WD镜头到物体距离600mm
C单位转换 um -> mm1000
WH幅宽,要拍摄物体大小330
S相机像元尺寸(相机型号尺寸)4.8 μm × 4.8 μm
Hmin需求精度 被测物体最小高度0.05 mm
WsSensor 靶面宽度3.2mm
2奈奎施特采样参数>=2
 输出参数
M放大倍数0.096
f焦距104.16  (公式2.1.5)

                                                                                                        表 1 

公式1:(最常理解,考虑能否拍下物体)

当考虑要拍全,也就是覆盖整个要拍摄的视野的FOV的时候,我们用 Ws,Sensor的靶面来计算,靶面往往用英寸:in来表示,我们要注意单位的转化:

Wd Wh 分别为物体距离相机传感器的距离和物体尺寸,这里由于相机的靶面一般为长方形,有宽高的定义,那么物体在视野上也分为宽高的长度,分别和i相机定义。

\LARGE f=(Wd \times Ws) \div (Wh)

【案例1】比如,我们测量10cm 下的一个物体,他有长度280mm,那么我们,要用传感器靶面的长边带入,假设,我们的Sensor是一个常用的OV5647,为1/4寸(长:3.6mm,宽2.7mm)

我们计算拍摄的物体的长边为:280mm

那么,我们可以得出需要的镜头焦距为【案,长度单位统一为毫米】:f = (100 * 3.2)  / 280  = 1.14 mm ,需要1.14mm的相机

公式2:(最常理解,考虑拍摄精度)

【案例2】考虑拍摄精度下的焦距计算,这时候,Wh为我们要拍摄的物体精度,比如 1mm最小的物体,S为相机像元的大小,这两个值,再加上距离,理论上就可以计算需要的焦距了,

我们已知OV5647的相元的尺寸为:1.4um,

f = (100 * 1.4 * 0.001)/ 1 = 0.14 mm 

【Franklin案,现在我们看案例1,和案例2,两个约束下,焦距的要求是不一样的,】

那么,如果我们进一步分析,用案例1的条件,我们如果用OV5674,能到达多少测量精度呢?

现在,焦距为1.14mm 固定好,这时候,我们拍摄全部的物体长度,

也就是,

\LARGE Wh_{min} = Wd \times S \div f

【案例3】这时候的测量精度: Whmin = (100 * 1.4 * 0.001) / (1.14) = 0.12 mm ,这个精度比我们再案例2中设定的精度要高。原因,很简单,因为我们测量的物体比物体和相机的距离还要近。

然后,我们再分析案例2下能拍摄的物体长度,

【案例4】

\LARGE Wh = (Wd \times Ws) \div f

Wh = 100 * 3.2 / 0.14 = 2285, 也就是可以拍摄2285mm的视野内的物体,也就是如果我们精度要求比案例3要下降了,那么拍摄的FOV的理论值就提高了。

【Franklin,案,以上,把公式1给讲活了,希望大家能够理解】


于是,我们还可以有下列公式:

公式2,3

公式1 :【案,这里是计算表1 的实际结果】

f = (600*3.2)/330 = 5.8 mm

f = (600×4.8×0.001)÷0.05=57.6mm

f=(600×0.096)÷(1.096)=52.5mm


 已知靶面大小,求FOV,


2.1.6 镜头分辨率和MTF

【基本概念】

物方分辨率(Object Space Resolution)

是根据感光元件和匹配镜头的参数倒推出来的,用于描述这一套光学设备所能分辨的,位于被摄物体上的,细节极限。

比如一台带A型镜头的甲设备(使用α型号ccd),其物方分辨率是25μm,那就是说,这台设备拍摄工作距离上(以此确定某一个放大率)的一个标样,在理想条件下,能将被摄物上间隔25μm或者更大距离的两个点,判读为两个点。但是间距24μm或者更小的点,就只能判读成一个点了。

像方分辨率

就是我们一般摄影中讨论的分辨率,即lp/mm(对线每毫米),也有其他表示方式,就是你看到的上千的数据,即LW/PH(Line Widths per Picture Height,线宽每图像高),这两个是可以换算的。

2.1.6.1 镜头分辨率【物方】

2.1.6.1 镜头分辨率【像方】的需求计算(Line Pairs per millimeter

Lens resolution is commonly expressed in line pairs per millimeter (lp/mm), the measurement of which is performed at the factory and becomes part of the lens’ specification. The term describes the ability to discern the border (edge) between two lines, one black and one white, in an image produced by the

【however, also depends on contrast:

the greater the contrast the easier it is to determine a black/ white boundary.

The more line pairs per millimeter, the more contrast is required to discern the boundary difference.

Line pairs per millimeter, therefore, are meaningful only when expressed at a given contrast level.】

【Franklin 案】LP/MM 必须和对比度的等级结合才有意义

标识输入参数举例
靶面尺寸1/4

查表一:

D = 4   mm 

V = 2.4mm

H = 3.2 mm

RResolution640*480
WD镜头到物体距离600mm
S相机传感器像元尺寸(相机型号尺寸)4.8 μm × 4.8 μm
Hmin需求精度 被测物体最小高度0.05 mm
2奈奎施特采样参数>=2
 输出参数
f焦距
lp/mm镜头分辨率 - 每毫米可以排列的104.16  (公式2.1.5)

 公式2.1.5 【已知相机传感器相元,求镜头像方分辨率,LP/MM】:

1000/(2x4.8)=104.16,

 公式2.1.5-2 【传感器每个Pixel线对,LP/PIXEL】:

LP * Hmin = 104.16*0.05 = 5.2 lp/pixel

公式2.1.6 【已知相机传感器相元和相机分辨率,求镜头空间频率,Pixel/MM  -> LP/MM】:

P/mm = (R/S)  =

(640/3.2)/ = 200 Pixel/mm

[Franklin 案】 Pixel/mm 和 LP/mm ,由LP是 黑白相间,那么就是占用两个Pixel,

所以,

LP/MM = P/MM / 2 = (R/S)/2 =

(640/3.2)/ = 200 Pixel/mm = 100 LP/mm


小结:

当传感器像元为4.8um时候,计算所选用的镜头分辨率应该不小于104.16lp/mm,或者是5.2lp/pixel这样才能保证系统分辨率最佳;


举例2:

【注意】

Note that, for machine vision applications, >= 30% contrast is the suggested value at which to select lp/mm.


2.1.6.2 MTF(Modulation Transfer Function

【The ability of a lens to resolve to a certain clarity is determined by the lens material, the quality of the manufacture, number of stages, and the laws of physics. Unlike the pixel matrix, however, lens resolution is not discretely digital;

it is analog and affected by many variables such as

  1. location within the lens,
  2. light intensity,
  3. contrast, and
  4. wavelength.】

【上图0】

【案 Franklin】Wikipedia has an excellent technical discussion of MTF (Wikipedia, 2016). The concept is easily understood by looking at Figure 3. Note how the dot in (b) is much sharper than that in (e). The reason for this is that the lens is able to resolve a smaller area. The circular targets in (c) and (f) consist of light and dark areas, which become smaller towards the center of the circle. Modulation Transfer Function is defined as the response to a periodic alternating (sine) wave pattern. It is essentially a measure of the quality of the light transmission through the lens. The more repeatable the lens, the better the light transfer and the smaller the areas of contrast that can be seen. Observe that in image (c), the contrast is much sharper in smaller increments. MTF is often specified in “Line pairs per millimeter” with a higher value indicating a higher quality lens.

To further complicate matters, MTF is different in the center of the lens from that at locations further from the center. This is because, by design, a lens distorts the light that passes through it in order to achieve the desired effects. For that reason, manufacturers will provide a graph illustrating MTF at various distances from the center of the lens.

MTF 作为一个重要的衡量分辨率和亮度的指标,我们看到好的镜头的MTF的曲线,在LP 比较高的情况下: 依旧保持0.3以上的亮度比

在0%附件

【上图1】Computar MTF曲线 ,

Figure  is a typical MTF graph.

The y-axis is the “Modulus of the OTF”, essentially a measure of the percentage of contrast; while the x-axis is the spatial frequency, a measure of the distance between contrasting areas as illustrated in 【上图0】.

What the chart illustrates is the degree of contrast differentiation lost as the spatial frequency increases.

Or, the closer together two contrasting objects are, the more difficult it is to differentiate between the two due to the resolution of the lens.

Because MTF varies with the curvature of the lens, multiple graphs are provided at various distances from the center of the lens. Thus, one may select the most conservative results, if necessary.

这里在0.5的附件,分辨率LP的取值,就是MV系统比较适合的分辨率取值,公式2.1.5同时可以算出,传感器的像元值。

【上图2】的镜头显然差于【上图1】的镜头MTF特性,在比较高阶的LP/mm的情况下,MTF都截止了。

2.1.6.3 镜头放大倍率计算

例如1

标识输入参数举例
C单位转换 um -> mm1000
S相机像元尺寸(相机型号尺寸)4.8 μm × 4.8 μm
Hmin需求精度 被测物体最小高度0.05 mm
2奈奎施特采样参数>=2
 输出参数
M放大倍数0.096
lp/mm镜头分辨率 - 每毫米可以排列的104.16  (公式2.1.5)

4.8÷(0.05×1,000)=0.096


 例如2:

如:已知相机芯片为2/3英寸(8.8mm*6.6mm),

视场长宽为:10mm* 8mm。

如用长边计算,放大倍率=8.8mm/10mm=0.88x;

如用短边计算,放大倍率=6.6mm/8mm=0.825x;

此时应取小的倍率0.825x 作为待选镜头的光学放大倍率。否则,短边视场将不能满足要求。(若取0.88倍,则短边视场=6.6mm/0.88x=7.5mm<8mm)。


3 综合举例1:


下面来看一个实际的镜头选型的例子:为视觉检测系统选择镜头,已知条件是:

相机靶面为1/4,像元尺寸为4.8um x4.8um ,C-mount,工作距离大于600mm,系统分辨率为0.05mm, 光源采用红色LED光源。

第一:因为采用红色光源,所以肯定是普通的可见光镜头;

第二:工作距离不变,分辨率固定,可以知道镜头是定焦镜头;

第三:相机的Nyquist频率为:

1000/(2x4.8)=104.16,所选用的镜头分辨率应该不小于104.16lp/mm,这样才能保证系统分辨率最佳;

第四:工作焦距计算:镜头放大倍数为M=4.8÷(0.00.0965×1,000)=0.096,焦距=工作距离*放大倍数/(放大倍数+1)=f=(600×0.096)÷(1.096)=52.5mm,选择25mm焦距的镜头;

第五:根据以上说明,我们选择的镜头是:2/3”, C-mount,焦距为25mm,分辨率在80-100lp/mm的工业镜头。

2.1.7 M.O.D (Minimum Object Distance​​​​​最近物距​)  


总结:选型步骤

Putting it all Together Given the application accuracy requirements:

【Franklin案】

  1. 决定应用的场景
  • 包括FOV
  • 包括工作距离
  • 相机彩色、黑白
  1. 决定应用的基本参数
  • 1.Determine sensor resolution.决定传感器分辨率  
  • 2.Determine lens resolution and sensor format. 决定镜头和传感器类
  • lens focal length for the sensor format, 决定焦距和类型
  • then select the appropriate optical resolution. 决定合适的光学方案
  1. 已经性价比选型

once appropriate lens options have been determined, it becomes a matter of cost/ benefit.

An online search for a 50mm lens to accommodate either sensor format with 200 lp/mm may be obtained for approximately $1300; a lens with 120 lp/mm costs around $600


3 综合举例2:

3.1 两个最重要的指标:

When we are designing a machine vision system, two of our most important considerations are the sizes of the part and the defect.

  • FOV - 我们要看到的部分 ( the part )
  • within that FOV - 我们要在FOV (the defect)

Tht is, what is our Field of View (FOV) and within that FOV what is the smallest defect we can reliably detect? Let’s say the part is 40mm square and we need to detect a .02mm defect. The following formula determines the camera resolution required:

举例: FOV Part = 40mm , Defect = 0.2mm

公式2.2

FOV/ Defect size = Number of gradations (pixels)

40mm/ .02mm = 2,000 (pixel)

3.2 相机传感器初步选型

我们可以到相机的选择网站去找对应的Sensor的相机类型:

Camera finder - find your cameras quick and easy! : monochrome, C-mount and 6.0 MPix - 7.0 MPix

我们依据需求选型为:

a 6-megapixel camera has a raw pixel resolution of 3088 x 2076, which meets the minimum 2000 pixel requirement. Referring to the camera specification, we note that the sensor format is 1/ .8

[Franklin】这里因为是Defect,所以,取了最小的分辨率要求。这个要求要应用到长边、短边两个方向。

[【Franklin 案】看下,相机的SPEC,一般会有几个重要的计算参数

  • 分辨率 640*480
  • 像素尺寸 4.8um
  • 传感器靶面大小 1/4

]

本例参考靶面定义:

The dimensions for the example sensor are:

Diag Width Height Area

8.93 7.18 5.32 38.20

camera sensor is 2.4µm.

3.2 LENS初步选型

现在,我们来选LENS,刚才相机,我们选的Sensor是,3088 x 2076,2.4µm.,7.18 ​​​​​宽的Senson ​mm 

这样我们先计算出来,我们需要的MTF的分别率,

由公式公式2.1.6

(3088 pixels/ 7.18mm)/ 2 = 215 pixels/ mm.

这时候,我们查一下,MTF的曲线,镜头厂家提供:

上图显示,最大LP为160,

我们倒算一下,

LP/MM = P/MM / 2 = (R/S)/2 = 160

P/MM = 320 = (R/S)

如果S =  7.18mm ,那么 Resolution = 320 * 7.18 = 2297.6 (pixel) 

也就是,现在差不,镜头支持的最大分辨率为4MP百万像素的值。 

我们需要的是6M,这样就不满足了。

此外,还有 50%的Contrast需要,这样4M的分辨率变成2MP的。


参考:

【深度2】【工业相机】的相机靶面大小和测量精度的关系分析和计算:@opencv

1 工业相机的选择

https://www.youtube.com/watch?v=EzBZTEN5UyA

2 镜头 D H V 参数

HFOV,VFOV,DFOV定义 - 简书

3 A Practical Guide to Selecting the Right Lens for Your Machine Vision Camera

- 该文档我已经上传到我的资源里面了

Is your Lens the Weakest Link in your Hi-resolution Application?

4 镜头分辨率(解像力)参数

5 https://www.zhihu.com/question/34587586/answer/64567049

Image Sensor Format. (2017, August 9). Retrieved from Wikipedia: https://en.wikipedia.org/wiki/Image_sensor_format

6 Optical Format. (2017, August 9). Retrieved from Wikipedia: https://en.wikipedia.org/wiki/Optical_format

7 Resolution. (2017, August 9). Retrieved from Edmund Optics: https://www.edmundoptics.com/resources/application-notes/imaging/resolution/

8 相机焦距与视场角

相机焦距与视场角_白水煮蝎子的博客-CSDN博客_相机视场角

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Franklin

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值