[英]c++ opencv Mat Value
cv::Mat K(3, 3, cv::DataType<double>::type);
K.at<double>(0, 0) = 407.87327205;
K.at<double>(0, 1) = 0.0;
K.at<double>(0, 2) = 297.88672999;
K.at<double>(1, 0) = 0.0;
K.at<double>(1, 1) = 408.85701444;
K.at<double>(1, 2) = 217.4312281;
K.at<double>(2, 0) = 0.0;
K.at<double>(2, 1) = 0.0;
K.at<double>(2, 2) = 1.0;
C++ Opencv Mat => C++ Opencv 垫 =>
Can the source code last a bit shorter?源代码可以持续更短一点吗?
Sorry for the poor English.对不起英语不好。
Yes, use comma initialization :是的,使用 逗号初始化:
cv::Mat K = (cv::Mat_<double>(3, 3) <<
407.87327205, 0.0 , 297.88672999,
0.0 , 408.85701444, 217.4312281 ,
0.0 , 0.0 , 1.0
);
This (ab)uses the little-used comma operator in the C++ language.这 (ab) 使用 C++ 语言中很少使用的逗号运算符。 The outer parentheses are necessary for it to work!
外括号是它工作所必需的!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.