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<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
mycameraMatrix.at(0,0)
defaults tomycameraMatrix.at<uchar>(0,0)
-- clearly wrong.at<double>(0, 0)
-- correctsorry I mean at<double>(0,0) it was typo I will fix it
cout<< mycameraMatrix.at<double>(0,0) << endl;
no problem here
I was getting strange results, I re-wrote the program again carefully and the problem was gone .. I believe it was a dirty code problem ..thank you