[英]What does minDist(100) and the curly braces in this piece of code mean?
我刚刚遇到了一段使我感到困惑的代码。 这是一个头文件,定义了一个名为ColorDetector的类。 私有部分如下:
class ColorDetector {
private:
// minimum acceptable distance
int minDist;
// target color
cv::Vec3b target;
// image containing resulting binary map
cv::Mat result;
// inline private member function
// Computes the distance from target color.
int getDistance(const cv::Vec3b& color) const {
// return static_cast<int>(cv::norm<int,3>(cv::Vec3i(color[0]-target[0],color[1]-target[1],color[2]-target[2])));
return abs(color[0]-target[0])+
abs(color[1]-target[1])+
abs(color[2]-target[2]);
}
这是该类的公开声明,让我感到困惑:
public:
// empty constructor
ColorDetector() : minDist(100) {
// default parameter initialization here
target[0]= target[1]= target[2]= 0;
}
我不太清楚此构造函数中的语法。 mindset(100)在这里是什么意思,为什么将目标数组写在花括号内? 我用关键字“默认构造函数”和“默认参数”搜索了google,但没有找到相关文章。 有人可以在这里告诉我这段代码的确切含义吗?
这个的班
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.