我正在尝试构建一个将使用棋盘运行校准的类,我的问题是关于正方形的,假设正方形是 66 毫米,我应该把这个信息放在哪里,在制作 ObjectPoints 时,或者我的课在哪里基于本书opencv2计算机视觉应用程序编程食谱 的示例,并在检查opencv示例后将此值放入构建对象点,这是我的代码的一部分:
void Calibration::addPoints(const std::vector<cv::Point2f>&, const std::vector<cv::Point3f>&){
imagePoints.push_back(imageCorners);
objectPoints.push_back(objectCorners);
this->actualnumberOfFrames++;
if(actualnumberOfFrames == numberOfFrames){
this->calibrate();
}
}
void Calibration::setImageCorners(cv::vector<cv::Point2f> corners, cv::Size board){
actualBoardSize = board;
imageCorners.clear();
imageCorners = corners;
objectCorners.clear();
for (int i = 0; i < board.height; i++){
for(int j =0; j<board.width; j++){
objectCorners.push_back(cv::Point3f(float(i*66),float(j*66),0.0f)); // is that correct
}
}
this->addPoints(imageCorners,objectCorners);
}
double Calibration::calibrate(){
return cv::calibrateCamera(this->objectPoints,this->imagePoints,this->theFrameSIZE,this->cameraMatrix,this->distortionCoeff,this->rvec,this->tvecs,this->flag);
}
如果您需要更多信息来理解问题,我会解释。