OpenCV: imread gives CV_8UC3, can't convert to CV_8UC4?

匿名 (未验证) 提交于 2019-12-03 00:57:01

问题:

Need help with an image I try to load and convert with OpenCV:

Here is my code:

templ = imread("Template.bmp",-1); cout<<"templ before convert: "<<type2str(templ.type())<<endl; templ.convertTo(templ,CV_8UC4); cout<<"templ after convert: "<<type2str(templ.type())<<endl; 

This gives me always CV_8UC3! Is the image not made for converting to 4 channels or something like this? Or do I need a scaling factor (read about sth like this)?

Thanks for help, best regards!

回答1:

cvtColor( src,dst, CV_BGR2BGRA ); 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!