24,854
社区成员
发帖
与我相关
我的任务
分享
1. In grfmt_png.cpp, line 170 add a line that allows to push through the type (alpha channel) detection:
// Allow for PNG alpha channel here
if(color_type == PNG_COLOR_TYPE_RGB_ALPHA) {
m_type = CV_8UC4;
}
2. In grfmt_png.cpp, around line 220 allow for an alpha channel by commenting the following statements:
//png_set_strip_alpha( png_ptr );
3. In loadsave.cpp , line 222 we finally tweak the parent routine to be more flexible towards the channels returned. Here we replace the "3" by CV_MAT_CN(type):
type = CV_MAKETYPE(CV_MAT_DEPTH(type), CV_MAT_CN(type));
(Note all changes were performed against OpenCV 2.0)