:::c++
#include <opencv2/opencv.hpp>
#include <stdio.h>
int main(int argc, char** argv){
int x = cv::CV_8UC4;
std::cout << x;
return 0;
}
I'm actually trying to create a cv::Mat(r,c,cv::CV_8UC4,ptr,0)
but to identify the error, I created the above. Compiling with g++ or clang++ both give this error (clang version):
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)
Googling the error was of little help.
It's not cv::CV_8UC4
it's just CV_8UC4
For historical reasons and interop with the C version the macros aren't in the cv:: namespace
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With