2
:::c++
#include <opencv2/opencv.hpp>
#include <stdio.h>
int main(int argc, char** argv){
int x = cv::CV_8UC4;
std::cout << x;
return 0;
}
實際上,我試圖創建一個cv::Mat(r,c,cv::CV_8UC4,ptr,0)
但要找出錯誤,我創建了上面。使用g ++或clang ++編譯都會給出這個錯誤(鏗鏘版):OpenCV2,C++ - CV :: CV_8UC4預期不合格-ID
test.cpp:4:17: error: expected unqualified-id
int x = cv::CV_8UC4;
^
/usr/include/opencv2/core/types_c.h:584:17: note: expanded from macro 'CV_8UC4'
#define CV_8UC4 CV_MAKETYPE(CV_8U,4)
^
/usr/include/opencv2/core/types_c.h:578:32: note: expanded from macro 'CV_MAKETYPE'
#define CV_MAKETYPE(depth,cn) (CV_MAT_DEPTH(depth) + (((cn)-1) << CV_CN_SHIFT))
^
/usr/include/opencv2/core/types_c.h:576:33: note: expanded from macro 'CV_MAT_DEPTH'
#define CV_MAT_DEPTH(flags) ((flags) & CV_MAT_DEPTH_MASK)
使用Google搜索錯誤沒有多大幫助。