Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c++

opencv

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!

like image 660
Bl4cke4gle Avatar asked Sep 24 '13 18:09

Bl4cke4gle


1 Answers

cvtColor( src,dst, CV_BGR2BGRA );
like image 143
berak Avatar answered Nov 15 '22 15:11

berak