코드 3-11 Mat 행렬 정보 참조하기 [ch03/MatOp]

    01    void MatOp5()
    02    {
    03        Mat img1 = imread("lenna.bmp");
    04     
    05        cout << "Width: " << img1.cols << endl;
    06        cout << "Height: " << img1.rows << endl;
    07        cout << "Channels: " << img1.channels() << endl;
    08     
    09        if (img1.type() = = CV_8UC1)
    10            cout << "img5 is a grayscale image." << endl;
    11        else if (img1.type() = = CV_8UC3)
    12            cout << "img5 is a truecolor image." << endl;
    13     
    14        float data[] = { 2.f, 1.414f, 3.f, 1.732f };
    15        Mat mat1(2, 2, CV_32FC1, data);
    16        cout << "mat1:\n" << mat1 << endl;
    17    }

    신간 소식 구독하기
    뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.