C++ 如何通过calcBackProject获取包含255以上数字或十进制数的反投影矩阵?

C++ 如何通过calcBackProject获取包含255以上数字或十进制数的反投影矩阵?,c++,opencv,scale,C++,Opencv,Scale,我需要使用calcBackProject,然后显示确切的数字 for ( int i = 0; i < backProj.rows; ++i ) { for ( int j = 0; j < backProj.cols; ++j ) { cout << int(backProj.at< uchar >( i, j )) << " "; } cou

我需要使用calcBackProject,然后显示确切的数字

    for ( int i = 0; i < backProj.rows; ++i )
    {
        for ( int j = 0; j < backProj.cols; ++j )
        {
            cout << int(backProj.at< uchar >( i, j )) << " ";
        }
        cout << endl;
    }
使用calcBackProject后,显示它

    cout << backProj.at< double >( i, j );
cout(i,j);
但它不起作用

我真的需要大于255的确切数字。我以前不想使用normalize。我可以通过calcBackProject完成吗

如果我尝试缩小它的比例,这个反投影矩阵能包含小数吗?因为我不希望这个矩阵中存在0


谢谢。

最后,我编写了自己的函数来获取反投影。希望它能帮助那些有同样问题的人

float ReadValueFromHist( const Mat& hist, const int x, const int y ) const
{
    int indexAlpha = int( mat.at< Vec4b >( x, y )[ 3 ] ) * bins / 256;
    return hist.at< float >( indexAlpha, 0 );
}

void CalcBackProj()
{
    backProj = Mat( mat.rows, mat.cols, CV_32FC1);
    for ( int i = 0; i < mat.rows; ++i )
    {
        for ( int j = 0; j < mat.cols; ++j )
        {
            backProj.at< float >( i, j ) = ReadValueFromHist( hist, i, j );
        }
    }
}
float ReadValueFromHist(常量Mat&hist,常量int x,常量int y)常量
{
int indexAlpha=int(材料在(x,y)[3])*bin/256;
返回处的历史记录(indexAlpha,0);
}
void CalcBackProj()
{
backProj=垫(垫行、垫列、CV_32FC1);
对于(int i=0;i(i,j)=ReadValueFromHist(hist,i,j);
}
}
}
float ReadValueFromHist( const Mat& hist, const int x, const int y ) const
{
    int indexAlpha = int( mat.at< Vec4b >( x, y )[ 3 ] ) * bins / 256;
    return hist.at< float >( indexAlpha, 0 );
}

void CalcBackProj()
{
    backProj = Mat( mat.rows, mat.cols, CV_32FC1);
    for ( int i = 0; i < mat.rows; ++i )
    {
        for ( int j = 0; j < mat.cols; ++j )
        {
            backProj.at< float >( i, j ) = ReadValueFromHist( hist, i, j );
        }
    }
}