Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

mat output different in different data type

I am confusing on the output of Mat. I tried to print the elements on the terminal using different data type, but result vary.

this is code

        Mat rowMean;
    rowMean = Mat::zeros(1, 10, CV_32F);


    for (int i=0; i<rowMean.cols; i++)
    {
            std::cout<<rowMean.at<int>(1,i)<<" ";
    }
    std::cout << std::endl;

    std::cout<<rowMean<<std::endl;

while the result is vary

65 0 1956498344 32527 1956498344 32527 0 0 0 0 
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

that is interesting, could you anyone can tell me what is going on? thank you.

mat output different in different data type

I am confusing on the output of Mat. I tried to print the elements on the terminal using different data type, but result vary.

this is code

        Mat rowMean;
    rowMean = Mat::zeros(1, 10, CV_32F);


    for (int i=0; i<rowMean.cols; i++)
    {
            std::cout<<rowMean.at<int>(1,i)<<" ";
    }
    std::cout << std::endl;

    std::cout<<rowMean<<std::endl;

while the result is vary

65 0 1956498344 32527 1956498344 32527 0 0 0 0 
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

that is interesting, could you anyone can tell me what is going on? thank you.

mat output different in different data type

I am confusing on the output of Mat. I tried to print the elements on the terminal using different data type, but result vary.

this is code

        Mat rowMean;
    rowMean = Mat::zeros(1, 10, CV_32F);


    for (int i=0; i<rowMean.cols; i++)
    {
            std::cout<<rowMean.at<int>(1,i)<<" ";
    }
    std::cout << std::endl;

    std::cout<<rowMean<<std::endl;

while the result is vary

65 0 1956498344 32527 1956498344 32527 0 0 0 0 
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

that is interesting, could anyone can tell me what is going on? thank you.