void LUT(InputArray src, InputArray lut, OutputArray dst)

来源:互联网 发布:腾讯数据分析招聘 编辑:程序博客网 时间:2024/05/29 07:22




夏天好热= =

我一直念念不忘的是

LUT = =

今天终于可以解开她的所有衣物 = =

不只是真面目哟

当然

完成这个任务的

依旧是我们最爱的

lena 桑

【20】void LUT(InputArray src, InputArray lut, OutputArray dst)


void LUT(InputArray src, InputArray lut, OutputArray dst)

http://www.opencv.org.cn/opencvdoc/2.3.2/html/modules/core/doc/operations_on_arrays.html?highlight=lut#void LUT(InputArray src, InputArray lut, OutputArray dst)

LUT速度之快大家已经感受过了吧

LUT

本质上就是一个RAM。

它把数据事先写入RAM后,
每当输入一个信号就等于输入一个地址进行查表,
找出地址对应的内容,
然后输出。

void LUT(InputArray src, InputArray lut, OutputArray dst)

src – Source array of 8-bit elements. 【8U pr 8S】

lut – Look-up table of 256 elements. 【256】
In case of multi-channel source array, the table should either have a single channel (in this case the same table is used for all channels) or the same number of channels as in the source array.

dst – Destination array of the same size and the same number of channels as src , and the same depth as lut




        uchar table[256];

        for (int i = 0; i < 256; i++) {
                table[i] = 255 - i;
        }

        Mat lookUpTable(1, 256, CV_8U);
        uchar* p = lookUpTable.data;
        for( int i = 0; i < 256; ++i)
                p[i] = table[i];

        LUT(src, lookUpTable, dst);



大家看一下下面的数据吧 = =
弄了前64个出来





src里的 第一个元素 125

经过查找表运算后得到

dst里的 第一个元素 130

而查找表里
LookUpTable[125] = 130

说明了这样一种变换

src[i,j] = g => LUT[g] = k => dst[i,j] = k

这样的线性变换我们可以做很多事情 = =
比如‘

 ···

不告诉你 = 3=






原创粉丝点击