1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
/* C1 C2 C3 C4 CV_8U 0 8 16 24 CV_8S 1 9 17 25 CV_16U 2 10 18 26 CV_16S 3 11 19 27 CV_32S 4 12 20 28 CV_32F 5 13 21 29 CV_64F 6 14 22 30 Unsigned 8bits uchar 0~255 IplImage: IPL_DEPTH_8U Mat: CV_8UC1, CV_8UC2, CV_8UC3, CV_8UC4 Signed 8bits char -128~127 IplImage: IPL_DEPTH_8S Mat: CV_8SC1,CV_8SC2,CV_8SC3,CV_8SC4 Unsigned 16bits ushort 0~65535 IplImage: IPL_DEPTH_16U Mat: CV_16UC1,CV_16UC2,CV_16UC3,CV_16UC4 Signed 16bits short -32768~32767 IplImage: IPL_DEPTH_16S Mat: CV_16SC1,CV_16SC2,CV_16SC3,CV_16SC4 Signed 32bits int -2147483648~2147483647 IplImage: IPL_DEPTH_32S Mat: CV_32SC1,CV_32SC2,CV_32SC3,CV_32SC4 Float 32bits float -1.18*10-38~3.40*10-38 IplImage: IPL_DEPTH_32F Mat: CV_32FC1,CV_32FC2,CV_32FC3,CV_32FC4 Double 64bits double Mat: CV_64FC1,CV_64FC2,CV_64FC3,CV_64FC4 Unsigned 1bit bool IplImage: IPL_DEPTH_1U */ //example: int number_of_rows, number_of_columns; number_of_rows=3; number_of_columns=4; cv::Mat mat_CV_8U(number_of_rows, number_of_columns,CV_8UC1); std::cout<<"mat_CV_8U.type(): " <<mat_CV_8U.type() <<std::endl; cv::Mat mat_CV_64FC1(number_of_rows, number_of_columns,CV_64FC1); std::cout<<"mat_CV_64FC1.type(): " <<mat_CV_64FC1.type() <<std::endl; |
ref: Special thanks to this post.