【开发日志】2023.06 ZENO----ObjectRecog----imageFeatureMatch 、PoseEstimation-Matrix

SIFT PIC1 

SIFT PIC2

Perspective Matrix

Fundamental Matrix

Essential Matrix

Homography Matrix

 
imageFeatureMatch add perspective\fundamental\essential\homography Matrix by Angelyatou · Pull Request #1189 · zenustech/zeno (github.com)https://github.com/zenustech/zeno/pull/1189


单应性Homograph估计:从传统算法到深度学习 - 知乎 (zhihu.com)https://zhuanlan.zhihu.com/p/74597564

opencv 单应性矩阵计算函数findHomography - 知乎 (zhihu.com)https://zhuanlan.zhihu.com/p/511844759


Camera Calibration and 3D Reconstruction — OpenCV 2.4.13.7 documentationhttps://docs.opencv.org/2.4/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html#camera-calibration-and-3d-reconstruction


 

EstimateCameraParams

相机矩阵(Camera Matrix) - 简书 (jianshu.com)https://www.jianshu.com/p/2341da36aa8e

c++ - OpenCV findEssentialMat and recoverPose with different camera matrix for left and right - Stack Overflowhttps://stackoverflow.com/questions/66296757/opencv-findessentialmat-and-recoverpose-with-different-camera-matrix-for-left-an

#include <iostream>
#include <Eigen/Dense>

Eigen::Matrix3d computeEssentialMatrix(const Eigen::MatrixXd& points1, const Eigen::MatrixXd& points2)
{
    // Convert pixel coordinates to normalized plane coordinates
    Eigen::MatrixXd normalizedPoints1 = points1.colwise().homogeneous();
    Eigen::MatrixXd normalizedPoints2 = points2.colwise().homogeneous();

    // Construct the matrix A for the linear equation system
    Eigen::MatrixXd A(points1.rows(), 9);
    for (int i = 0; i < points1.rows(); ++i) {
        A.row(i) << normalizedPoints2(i, 0) * normalizedPoints1(i, 0),
                    normalizedPoints2(i, 0) * normalizedPoints1(i, 1),
                    normalizedPoints2(i, 0),
                    normalizedPoints2(i, 1) * normalizedPoints1(i, 0),
                    normalizedPoints2(i, 1) * normalizedPoints1(i, 1),
                    normalizedPoints2(i, 1),
                    normalizedPoints1(i, 0),
                    normalizedPoints1(i, 1),
                    1.0;
    }

    // Perform singular value decomposition (SVD) on matrix A
    Eigen::JacobiSVD<Eigen::MatrixXd> svd(A, Eigen::ComputeFullV);

    // Extract the column of V corresponding to the smallest singular value
    Eigen::VectorXd singularValues = svd.singularValues();
    Eigen::MatrixXd ematrix = svd.matrixV().col(svd.matrixV().cols() - 1).reshaped().topRows(3);

    // Rectify the essential matrix to satisfy constraints
    Eigen::JacobiSVD<Eigen::MatrixXd> svd2(ematrix, Eigen::ComputeFullU | Eigen::ComputeFullV);
    Eigen::VectorXd singularValues2 = svd2.singularValues();
    singularValues2[2] = 0.0; // Force the third singular value to be zero
    ematrix = svd2.matrixU() * singularValues2.asDiagonal() * svd2.matrixV().transpose();

    return ematrix;
}

int main()
{
    // Assume we have matched feature point correspondences as Eigen matrices
    Eigen::MatrixXd points1(4, 2);
    points1 << 10, 20,
               30, 40,
               50, 60,
               70, 80;

    Eigen::MatrixXd points2(4, 2);
    points2 << 15, 25,
               35, 45,
               55, 65,
               75, 85;

    // Compute the essential matrix
    Eigen::Matrix3d essentialMatrix = computeEssentialMatrix(points1, points2);

    std::cout << "Essential Matrix:\n" << essentialMatrix << std::endl;

    return 0;
}


Computing Homography | Image Stitching - YouTubehttps://www.youtube.com/watch?v=l_qjO4cM74o

 

 

 

 

 

 

 

 

cv::Ptr<cv::DescriptorMatcher> matcher = cv::DescriptorMatcher::create(cv::DescriptorMatcher::BRUTEFORCE);
        std::vector<std::vector<cv::DMatch>> knnMatches;
        std::vector<cv::DMatch> filteredMatches;
        matcher->knnMatch(imagecvdescriptors1, imagecvdescriptors2, knnMatches, 2);
        filteredMatches.reserve(knnMatches.size());
        auto &md = image3->tris.add_attr<float>("matchDistance");
        int mdi = 0;
        for (const auto& knnMatch : knnMatches) {
            if (knnMatch.size() < 2) {
                continue;
            }
            float distanceRatio = knnMatch[0].distance / knnMatch[1].distance;
            if (distanceRatio < matchD) {
                filteredMatches.push_back(knnMatch[0]);
                md[mdi] = static_cast<float>(knnMatch[0].distance);
                mdi++;
            }
        }
        zeno::log_info("BRUTEFORCE  knnMatches.size:{},filteredMatches.size:{}",knnMatches.size(),filteredMatches.size());

 

 

 

 

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值