0
点赞
收藏
分享

微信扫一扫

特征提取与检测14-平面对象识别

林塬 2022-02-13 阅读 49

平面对象识别

    对象形变与位置变换

    代码演示

对象形变与位置变换

1. findHomography – 发现两个平面的透视变换,生成变换矩阵

2. perspectiveTransform 透视变换

代码演示

#include <opencv2/opencv.hpp>
#include <opencv2/xfeatures2d.hpp>
#include <iostream>
#include <math.h>


using namespace cv;
using namespace std;
using namespace cv::xfeatures2d;


int main(int argc, char** argv) {
    Mat img1 = imread("D:/vcprojects/images/box.png", IMREAD_GRAYSCALE);
    Mat img2 = imread("D:/vcprojects/images/box_in_scene.png", IMREAD_GRAYSCALE);
    if (!img1.data || !img2.data) {
        return -1;
    }
    imshow("object image", img1);
    imshow("object in scene", img2);


    // surf featurs extraction
    int minHessian = 400;
    Ptr<SURF> detector = SURF::create(minHessian);
    vector<KeyPoint> keypoints_obj;
    vector<KeyPoint> keypoints_scene;
    Mat descript
举报

相关推荐

0 条评论