Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

cv::Mat initialization

Hello everyone I have a question regarding cv::mat and how to deal with them for example if I use this

 double mydata[9] = { 3.3319948389423814e+02, 0., 6.4337005710516598e+02, 0.,
 3.3365591993191464e+02 ,5.3634048332458769e+02, 0. ,0. ,1. };
 Mat mycameraMatrix = Mat(3, 3, CV_64F, mydata);

and then I used

cout<<mycameraMatrix

or

cout<<mycameraMatrix.at(0,0)

I got completely different values from the values of array (mydata)

so instead I wrote this

Mat mycameraMatrix = Mat(3, 3, cv::DataType<double>::type);
mycameraMatrix.at<double>(0, 0) = 3.3319948389423814e+02;
mycameraMatrix.at<double>(0, 1) = 0.0;
......

so is that correct? and why the values are changing in the first method

cv::Mat initialization

Hello everyone I have a question regarding cv::mat and how to deal with them for example if I use this

 double mydata[9] = { 3.3319948389423814e+02, 0., 6.4337005710516598e+02, 0.,
 3.3365591993191464e+02 ,5.3634048332458769e+02, 0. ,0. ,1. };
 Mat mycameraMatrix = Mat(3, 3, CV_64F, mydata);

and then I used

cout<<mycameraMatrix

or

cout<<mycameraMatrix.at(0,0)
cout<<mycameraMatrix.at<double>(0,0)

I got completely different values from the values of array (mydata)

so instead I wrote this

Mat mycameraMatrix = Mat(3, 3, cv::DataType<double>::type);
mycameraMatrix.at<double>(0, 0) = 3.3319948389423814e+02;
mycameraMatrix.at<double>(0, 1) = 0.0;
......

so is that correct? and why the values are changing in the first method method