I've just met a piece of code that made me confused. It's a header file that defines a class named ColorDetector. The private part is as follows:
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]);
}
Here's the public declaration of this class that made me confused:
public:
// empty constructor
ColorDetector() : minDist(100) {
// default parameter initialization here
target[0]= target[1]= target[2]= 0;
}
I am not quite clear about the grammar in this constructor here. What does mindset(100) mean here and why the target array is written within curly braces? I searched google with keyword "default constructor" and "default parameter" but found no relating articles. Can someone tell me the exact meaning of this piece of code here?
The class of this