本文主要是介绍OpenCV编程-双目匹配计算棋盘格角点计算及两轴位移计算,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
//两幅图像的棋盘格角点检测cv::Mat image_gray=img11;std::vector<cv::Point2f> cornersL, cornersR;bool retL = cv::findChessboardCorners(image_gray,cv::Size(11, 8),cornersL,cv::CALIB_CB_ADAPTIVE_THRESH |cv::CALIB_CB_NORMALIZE_IMAGE);cv::Mat image_gray1 = img21;bool retR = cv::findChessboardCorners(image_gray1,cv::Size(11, 8),cornersR,cv::CALIB_CB_ADAPTIVE_THRESH |cv::CALIB_CB_NORMALIZE_IMAGE);
vector<uchar> m;vector<float> vx;vector<float> vy;float vxa=0, vya=0;for (int i = 0; i < cornersL.size(); i++){vx.push_back(cornersL[i].x - cornersR[i].x);vy.push_back(cornersL[i].y - cornersR[i].y);vxa = vxa + cornersL[i].x - cornersR[i].x;vya = vya + cornersL[i].y - cornersR[i].y;cout << "x is "<<cornersL[i].x - cornersR[i].x << " ";cout << "y is "<<cornersL[i].y - cornersR[i].y << endl;}//输出棋盘格角点X轴、Y轴平均位移vxa = vxa / cornersL.size();vya = vya / cornersL.size();
这篇关于OpenCV编程-双目匹配计算棋盘格角点计算及两轴位移计算的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!