cv::Mat matrix= cv::Mat::zeros(3,4,CV_8U); matrix.at<float>(0,0)=1; matrix.at<float>(0,1)=2; matrix.at<float>(0,2)=3; matrix.at<float>(1,0)=4; matrix.at<float>(1,1)=5; matrix.at<float>(1,2)=6; matrix.at<float>(2,0)=7; matrix.at<float>(2,1)=8; matrix.at<float>(2,2)=9; for (int i=0;i<matrix.rows;i++){ for (int j=0;j<matrix.cols;j++){ float temp= matrix.at<float>(i,j); std::cout<<temp; std::cout<<" "; } std::cout<<std::endl; } Excpected output:
1230
4560
7890
Current output:
1478
4789
7890
What's wrong?
Current outputin any case does not correspond to the code in the example, since in the example, a space is displayed after each value. You probably need to rebuild the project, or you are misleading us. - Ariox