Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

you could just go and interpol single cols:


Mat l(100,200,CV_8UC3,Scalar(255,0,0)); // you probably want to imread your img,
Mat r(100,200,CV_8UC3,Scalar(0,0,255)); // this is just to show the effect nicely
Mat res(l.size(),l.type());
double step = 1.0 / l.cols;
double blend = 0.0;
for ( int i=0; i<l.cols; i++ )
{
    res.col(i) = l.col(i) * blend + r.col(i) * (1.0-blend);
    blend += step;
}
imwrite("blended.png",res);
imshow("lalala",res);
waitKey();

blended: