我必须使用lerp函数来插值两个图像。帖子How to perform a linear interpolation between to images推荐这个方法dst [x] [y] .r = lerp(factor,src1 [x] [y] .r,src2 [ x] [y] .r)但我无法得到所需的结果,因为我得到错误使用[,]括号可以任何人在open cv C ++中提出更好的方法
答案 0 :(得分:1)
假设您需要以下lerp功能:
src1*(1-factor)+src2*factor;
它可以在OpenCV中实现,如下所示:
cv::Mat src1, src2; // These two images have to be the same size and type
cv::Mat result;
double factor = 0.5; // [0, 1]
cv::addWeighted(src1, 1.0-factor, src2, factor, 0.0, result);