opencv模板匹配算法

                                 opencv模板匹配算法

//todo 模板匹配  istun:是否旋转    xishu:旋转的密度系数
void ScanToPointCloud2Converter::matchTemplatesFun(const Mat &dst2, const Mat &image2,bool isturn,int xishu) {//todo 模板匹配
    vector matchTemplatestructs;
    if(isturn){//用图片旋转后会导致像素位置对不上原来的位置,我们采用控制小车作旋转
        for (int j = 0; j < (360 * xishu); ++j) {
            // todo 旋转图片
            double angle = j, scale = 1;
            int h = dst2.cols, w = dst2.rows;
            //目标图像的大小,避免crop,fabs(sin(angle * CV_PI / 180)
            int bound_w = (h * fabs(sin(angle / xishu * CV_PI / 180)) + w * fabs(cos(angle / xishu * CV_PI / 180))) * scale;
            int bound_h = (h * fabs(cos(angle / 

你可能感兴趣的:(新ros专栏,opencv,算法,计算机视觉,ros,slam)