Ask Your Question

Revision history [back]

You cannot use a Vec4f if data are uchar you will get an exception.

You have to check that overlay2 is read :

if (overlay2.empty())
{
     cout<< "Image is empty. Check file path";
     return;
}
cout<< "Channels "<<overlay2.channels()<<endl;
if (channels!=4)
{
     cout<< "should be 4 and not"<<. overlay2.channels()<<endl;
     return;
}

if my memory png can be 8 bits or 16 bits It can be Vec4b, Vec4s or Vec4w but not Vec4f Vec4f means 128 bits per pixel