精品文档---下载后可任意编辑本节对应-----第 3 章 Processing Imageswith Classes 中的 Using a Controller to communicate with processing modules 的部分
本节把书中的提要详细化,给自已备份的同时也希望给别人一点启发
开始一、打开 VS2024,建立项目二、下一步后,原来的“使用 Unicode 库”勾去掉
三、完成后,出现编辑界面四、编辑对话框,设计成如下界面
精品文档---下载后可任意编辑五、点开“解决方案资源管理器”,添加头文件 colordetector
defined COLORDETECT#define COLORDETECT#includeclass ColorDetector{private://minimum acceptable distanceint minDist;//target colorcv::Vec3b target;//image containing resulting binary mapcv::Mat result;//inline private member function//Computes the distance from target color
int getDistance(const cv::Vec3b& color)const;public://empty constructorColorDetector():minDist(100) {// default parameter initialization heretarget[0] = target[1] = target[2] = 0; }//Getters and setters//Sets the color distance threshold//