코드 3-13 크기 및 타입 변환 함수 사용 예 [ch03/MatOp]
01 void MatOp7() 02 { 03 Mat img1 = imread("lenna.bmp", IMREAD_GRAYSCALE); 04 05 Mat img1f; 06 img1.convertTo(img1f, CV_32FC1); 07 08 uchar data1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }; 09 Mat mat1(3, 4, CV_8UC1, data1); 10 Mat mat2 = mat1.reshape(0, 1); 11 12 cout << "mat1:\n" << mat1 << endl; 13 cout << "mat2:\n" << mat2 << endl; 14 15 Mat mat3 = Mat::ones(1, 4, CV_8UC1) * 255; 16 mat1.push_back(mat3); 17 cout << "mat1:\n" << mat1 << endl; 18 19 mat1.resize(6, 100); 20 cout << "mat1:\n" << mat1 << endl; 21 }