当前位置:网站首页>Feature extraction and detection 14 plane object recognition

Feature extraction and detection 14 plane object recognition

2022-07-06 14:12:00 QT Visual Science

Plane object recognition

     Object deformation and position transformation

     Code demonstration

Object deformation and position transformation

1. findHomography – Find the perspective transformation of two planes , Generating transformation matrix

2. perspectiveTransform Perspective transformation

Code demonstration

#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
原网站

版权声明
本文为[QT Visual Science]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202131412406114.html