在机器视觉应用中,由于现场环境与视觉硬件的因素影响,采集的图像亮度、对比度可能不符合我们的需求,通过查找表LUT可以进行增强改善。你需要了解的就是LUT的定义、何时使用、概念、变换函数、应用案例、预定义查找表的作用。
Lookup Tables
1、查找表LUT的定义
The lookup table (LUT) transformations are basic image-processing functions that highlight details in areas containing significant information,at the expense of other areas.
查找表(LUT)转换是基本的图像处理函数,用于突出显示包含重要信息的区域中的细节,以牺牲其他区域为代价。
These functions include histogram equalization, gamma corrections, logarithmic corrections, and exponential corrections.
这些功能包含直方图均衡化、伽马校正、对数校正和指数校正。
When to Use
2、查找表LUT何时使用
Use LUT transformations to improve the contrast and brightness of an image by modifying the dynamic intensity of regions with poor contrast.
使用LUT变换通过修改对比度差的区域的动态强度来提高图像的对比度和亮度。
Concept
3、查找表LUT变换的函数
A LUT transformation converts input gray-level values from the source image into other gray-level values in the transformed image.
LUT变换将源图像中的输入灰度值转换为变换图像中的其他灰度值。
A LUT transformation applies the transform T(x) over a specified input range [rangeMin, rangeMax] in the following manner:
LUT变换通过在指定的输入范围[rangeMin,rangeMax]内按以下方式应用变换T(x):
T(x) = dynamicMin if x ≤ rangeMin
如果X小于范围最小值,那么T(x) =动态最小值f(x) if rangeMin < x ≤ rangeMax
如果X大于范围最小值而小于范围最大值,那么
dynamicMax if x > rangeMax
如果X大于范围最大值,那么取动态最大值
Where
x represents the input gray-level value
X表示输入的灰度
dynamicMin = 0 (8-bit images) or the smallest initial pixel value (16-bit and floating point images)
动态最小值=0 (8位图像)或者最小的初始像素值(16位和浮点图像)
dynamicMax = 255 (8-bit images) or the largest initial pixel value (16-bit and floating point images)
动态最大值=255 (8位图像)或者最大的初始像素值(16位和浮点图像)
dynamicRange = dynamicMax - dynamicMin
动态范围=动态最大值-动态最小值
f(x) represents the new value.
f(x) 呈现新的数据
The function scales f(x) so that f(rangeMin) = dynamicMin and f(rangeMax) = dynamicMax
函数缩放f(x),使f(rangeMin)=dynamicMin和f(rangeMax)=dynamicMax
f(x) behaves on [rangeMin, rangeMax] according to the method you select
f(x)根据您选择的方法在[rangeMin,rangeMax]上执行
In the case of an 8-bit resolution, a LUT is a table of 256 elements
在8位分辨率的情况下,LUT是由256个元素组成的表
The index element of the array represents an input gray-level value
数组的索引元素表示输入的灰度值
The value of each element indicates the output value.
每个元素的值表示输出值
The transfer function associated with a LUT has an intended effect on the brightness and contrast of the image.
与LUT相关联的传递函数对图像的亮度和对比度具有预期的效果。
4、查找表LUT的应用案例
The following example uses the following source image.
以下的案例使用了下图的源图像
In the linear histogram of the source image,the gray-level intervals [0, 49] and [191, 254] do not contain significant information.
在源图像的线性直方图中,灰度区间[0,49]和[191,254]不包含重要信息。
图1
Using the following LUT transformation, any pixel with a value less than 49 is set to 0, and any pixel with a value greater than 191 is set to 255.
使用以下LUT转换,灰度值小于49的任何像素设置为0,灰度值大于191的任何像素设置为255。
The interval [50, 190] expands to [1, 254], increasing the intensity dynamic of the regions with a concentration of pixels in the gray-level range [50, 190].
间隔[50,190]扩展到[1,254],增加灰度范围内像素集中的区域的强度动态[50,190]。
图2
The LUT transformation produces the following image. The linear histogram of the new image contains only the two peaks of the interval [50, 190].
LUT转换生成以下图像。新图像3的线性直方图只包含区间的两个峰值[50,190],比图1的效果明显增强了。
图3
Predefined Lookup Tables
5、预定义查找表介绍
Seven predefined LUTs are available in NI Vision: Linear, Logarithmic, Power 1/Y, Square Root, Exponential, Power Y, and Square.
NI Vision视觉软件中提供了七个预定义lut:线性、对数、幂1/Y、平方根、指数、幂Y和平方。
LUT | Transfer Function | Shading Correction |
Linear 线性 | Increases the intensity dynamic by evenly distributing a given gray-level interval [min, max] over the full gray scale [0, 255]. 通过在整个灰度范围内均匀分布给定的灰度区间[min,max],增加强度动态[0,255]。 Min and max default values are 0 and 255 for an 8-bit image. 对于8位图像,最小和最大默认值分别为0和255。 | |
Logarithmic Power 对数幂1/Y平方根 | Increases the brightness and contrast in dark regions. Decreases the contrast in bright regions. 增加黑暗区域的亮度和对比度。减少明亮区域的对比度。 | |
Exponential Power 指数幂Y正方形 | Decreases the brightness and contrast in dark regions. Increases the contrast in bright regions. 降低黑暗区域的亮度和对比度。增加明亮区域的对比度。 |