mat读取大于255的像素值

 

    Mat dst;
    input.convertTo(dst, CV_32S);
    int rows = dst.rows;
    int cols = dst.cols;
    for(int i = 0; i < rows; i++)
    {
        for(int j = 0; j < cols; j++)
        {
            cout << "value : " << dst.at<int>(i, j)  << endl ;
        }
    }



    Mat roi_dst;
    roi.convertTo(roi_dst, CV_64F);
    for(int i = 0; i < roi_dst.rows; i++)
    {
        for(int j = 0; j < roi_dst.cols; j++)
        {
            roi_data.push_back((int)roi_dst.at<double>(i, j));    
            cout << roi_dst.at<double>(i, j) << " " ;
        }
        cout << endl;
    }




 

posted @ 2023-08-31 16:05  小丑_jk  阅读(12)  评论(0编辑  收藏  举报