opencv Mat 多通道的使用

代码是8通道Mat的使用方法。

typedef cv::Vec<float, 8> Vec8f;
    E2 = cv::Mat::zeros(srcImage.rows, srcImage.cols, CV_32FC(8));//背景 E(0)值
    //CV_32FC3
    std::cout << "channel = " << E2.channels() << " \n ";
    for (int i = 0; i < E2.rows; i++)
    {
        for (int j = 0; j < E2.cols; j++)
        {
            for (int c = 0; c < E2.channels(); c++)
            {
                std::cout << "channel = " << c << "  ";
                std::cout << E2.at<Vec8f>(i, j)[c] << " ;i = " << i << " j= " << j << " c= " << c << "\n";
            }
        }
    }

https://www.cnblogs.com/cvtoEyes/p/8494516.html

猜你喜欢

转载自www.cnblogs.com/Bella2017/p/12929768.html