void LUT(InputArray src, InputArray lut, OutputArray dst, int interpolation=0 )
根据查找表在8位数组中进行替换,并将结果存储在dst中。
opencv official documentation on the function对interpolation
参数保持沉默。它用于什么以及可以为它传递什么值?
答案 0 :(得分:5)
这似乎是多余的(或者可能留待未来的扩展)。
如果你看看那个函数的实现,你会看到这个(请注意函数体第二行中的断言!):
void cv::LUT( InputArray _src, InputArray _lut, OutputArray _dst, int interpolation )
{
Mat src = _src.getMat(), lut = _lut.getMat();
CV_Assert( interpolation == 0 );
int cn = src.channels();
int lutcn = lut.channels();
CV_Assert( (lutcn == cn || lutcn == 1) &&
lut.total() == 256 && lut.isContinuous() &&
(src.depth() == CV_8U || src.depth() == CV_8S) );
_dst.create( src.dims, src.size, CV_MAKETYPE(lut.depth(), cn));
Mat dst = _dst.getMat();
LUTFunc func = lutTab[lut.depth()];
CV_Assert( func != 0 );
const Mat* arrays[] = {&src, &dst, 0};
uchar* ptrs[2];
NAryMatIterator it(arrays, ptrs);
int len = (int)it.size;
for( size_t i = 0; i < it.nplanes; i++, ++it )
func(ptrs[0], lut.data, ptrs[1], len, cn, lutcn);
}