发布时间:2026/8/29 17:59:37
OpenCV 位姿与投影变换 1. 旋转矩阵与旋转向量的相互转换1.1. 罗德里格斯公式符号^是向量到反对称的转换符。反之我们也可以计算从一个旋转矩阵到旋转向量的转换。对于转角θ有因此关于转轴n由于旋转轴上的向量在旋转后不发生改变说明转轴 n 是矩阵 R 特征值 1 对应的特征向量。求解此方程再归一化就得到了旋转轴。1.2. 转换函数void Rodrigues(const cv::Mat srccv::Mat dstcv::Mat jacobian0);参数说明src——为输入的旋转向量3x1或者1x3或者旋转矩阵3x3。该参数向量表示其旋转的角度用向量长度表示。dst——为输出的旋转矩阵3x3或者旋转向量3x1或者1x3。jacobian——为可选的输出雅可比矩阵3x9或者9x3是输入与输出数组的偏导数。2. 图像变换2.1. 去畸变2.1.1. 针孔相机调用方法std::vectorcv::Point2f inputDistortedPoints ... std::vectorcv::Point2f outputUndistortedPoints; cv::Mat cameraMatrix ... cv::Mat distCoeffs ... cv::undistortPoints(inputDistortedPoints, outputUndistortedPoints, cameraMatrix, distCoeffs, cv::noArray(), cameraMatrix);不要像下面这样调用输出的点不正确cv::undistortPoints(inputDistortedPoints, outputUndistortedPoints, cameraMatrix, distCoeffs2.1.2. 鱼眼相机cv::fisheye::undistortPoints(inputDistortedPoints, outputUndistortedPoints, cameraMatrix, distCoeffs, cv::noArray(), cameraMatrix);2.2. 投影2.2.1. 针孔相机函数void cv::projectPoints(InputArray objectPoints, InputArray rvec, InputArray tvec, InputArray cameraMatrix, InputArray distCoeffs, OutputArray imagePoints, OutputArray jacobian noArray(), double aspectRatio 0)ParametersobjectPointsArray of object points expressed wrt. the world coordinate frame. A 3xN/Nx3 1-channel or 1xN/Nx1 3-channel (or vectorPoint3f), where N is the number of points in the view.rvecThe rotation vector (Rodrigues) that, together with tvec, performs a change of basis from world to camera coordinate system, see calibrateCamera for details.tvecThe translation vector, see parameter description above.cameraMatrixCamera intrinsic matrixdistCoeffsInput vector of distortion coefficients (k1,k2,p1,p2[,k3[,k4,k5,k6[,s1,s2,s3,s4[,τx,τy]]]]) of 4, 5, 8, 12 or 14 elements . If the vector is empty, the zero distortion coefficients are assumed.imagePointsOutput array of image points, 1xN/Nx1 2-channel, or vectorPoint2f .jacobianOptional output 2Nx(10numDistCoeffs) jacobian matrix of derivatives of image points with respect to components of the rotation vector, translation vector, focal lengths, coordinates of the principal point and the distortion coefficients. In the old interface different components of the jacobian are returned via different output parameters.aspectRatioOptional fixed aspect ratio parameter. If the parameter is not 0, the function assumes that the aspect ratio (fx/fy) is fixed and correspondingly adjusts the jacobian matrix.示例#include opencv2/core/core.hpp #include opencv2/imgproc/imgproc.hpp #include opencv2/calib3d/calib3d.hpp #include opencv2/highgui/highgui.hpp #include iostream #include string using namespace std; vectorcv::Point3f Generate3DPoints(); int main(int argc, char* argv[]) { // Read 3D points vectorcv::Point3f objectPoints Generate3DPoints(); vectorcv::Point2f imagePoints; cv::Mat intrisicMat(3, 3, cv::DataTypefloat::type); // Intrisic matrix intrisicMat.atfloat(0, 0) 1.6415318549788924e003; intrisicMat.atfloat(1, 0) 0; intrisicMat.atfloat(2, 0) 0; intrisicMat.atfloat(0, 1) 0; intrisicMat.atfloat(1, 1) 1.7067753507885654e003; intrisicMat.atfloat(2, 1) 0; intrisicMat.atfloat(0, 2) 5.3262822453148601e002; intrisicMat.atfloat(1, 2) 3.8095355839052968e002; intrisicMat.atfloat(2, 2) 1; cv::Mat rVec(3, 1, cv::DataTypefloat::type); // Rotation vector rVec.atfloat(0) -3.9277902400761393e-002; rVec.atfloat(1) 3.7803824407602084e-002; rVec.atfloat(2) 2.6445674487856268e-002; cv::Mat tVec(3, 1, cv::DataTypefloat::type); // Translation vector tVec.atfloat(0) 2.1158489381208221e000; tVec.atfloat(1) -7.6847683212704716e000; tVec.atfloat(2) 2.6169795190294256e001; cv::Mat distCoeffs(5, 1, cv::DataTypefloat::type); // Distortion vector distCoeffs.atfloat(0) -7.9134632415085826e-001; distCoeffs.atfloat(1) 1.5623584435644169e000; distCoeffs.atfloat(2) -3.3916502741726508e-002; distCoeffs.atfloat(3) -1.3921577146136694e-002; distCoeffs.atfloat(4) 1.1430734623697941e-002; cout Intrisic matrix: intrisicMat endl endl; cout Rotation vector: rVec endl endl; cout Translation vector: tVec endl endl; cout Distortion coef: distCoeffs endl endl; std::vectorcv::Point2f projectedPoints; cv::projectPoints(objectPoints, rVec, tVec, intrisicMat, distCoeffs, projectedPoints); cout Press any key to exit.; cin.ignore(); cin.get(); return 0; } vectorcv::Point3f Generate3DPoints() { vectorcv::Point3f points; points.push_back(cv::Point3f(.5, .5, -.5)); points.push_back(cv::Point3f(.5, .5, .5)); points.push_back(cv::Point3f(-.5, .5, .5)); points.push_back(cv::Point3f(-.5, .5, -.5)); points.push_back(cv::Point3f(.5, -.5, -.5)); points.push_back(cv::Point3f(-.5, -.5, -.5)); points.push_back(cv::Point3f(-.5, -.5, .5)); for(unsigned int i 0; i points.size(); i) { cout points[i] endl endl; } return points; }2.2.2. 鱼眼相机函数// 提供了两个重载函数经验上第一个容易崩溃建议使用第二个 void cv::fisheye::projectPoints(InputArray objectPoints, OutputArray imagePoints, InputArray rvec, InputArray tvec, InputArray K, InputArray D, double alpha 0, OutputArray jacobian noArray()) void cv::fisheye::projectPoints(InputArray objectPoints, OutputArray imagePoints, const Affine3d affine, InputArray K, InputArray D, double alpha 0, OutputArray jacobian noArray())ParametersobjectPointsArray of object points, 1xN/Nx1 3-channel (or vectorPoint3f), where N is the number of points in the view.imagePointsOutput array of image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel, or vectorPoint2f.affine仿射变换可以使用位姿矩阵进行初始化KCamera intrinsic matrix cameramatrixK.DInput vector of distortion coefficients (k1,k2,k3,k4).alphaThe skew coefficient.jacobianOptional output 2Nx15 jacobian matrix of derivatives of image points with respect to components of the focal lengths, coordinates of the principal point, distortion coefficients, rotation vector, translation vector, and the skew. In the old interface different components of the jacobian are returned via different output parameters.参考文献OpenCV的projectPoints函数用法_JIN_嫣熙的博客-CSDN博客_projectpointsOpencv学习12——cv::Rodrigues()函数_令狐少侠、的博客-CSDN博客_rodrigues函数OpenCV: Camera Calibration and 3D ReconstructionOpenCV: Fisheye camera modelundistortPoints opencv_cvml的博客-CSDN博客

相关新闻

2026/8/28 5:35:41

vue动态改变el-table表格列

方法1 <template><div class"mainBox"><div class"optshowBox"><el-popover placement"bottom" trigger-"click" width"200" popper-class"popperStyle"><template #reference><…

2026/8/29 13:29:13

计算机毕业设计之容春茶叶商城系统设计与实现

本系统为用户而设计制作容春茶叶商城系统&#xff0c;旨在实现容春茶叶商城系统智能化、现代化管理。本容春茶叶商城系统自动化系统的开发和研制的最终目的是将容春茶叶商城系统的运作模式从手工记录数据转变为网络信息查询管理&#xff0c;从而为现代管理人员的使用提供更多的…

2026/8/29 17:57:37

金融时间序列波动率建模:从异方差到GARCH模型实战解析

1. 从“异方差”说起&#xff1a;为什么传统模型在金融时间序列面前失灵了 如果你处理过股票收益率、汇率波动或者加密货币的价格数据&#xff0c;大概率会遇到一个令人头疼的现象&#xff1a;数据的波动性似乎不是恒定的。平静期之后&#xff0c;往往跟着剧烈的波动&#xff0…

2026/8/29 17:57:37

MATLAB函数绘图:ezplot与fplot的对比与选择指南

1. 项目概述&#xff1a;为什么我们需要“随笔画图”&#xff1f; 如果你用过MATLAB&#xff0c;大概率对 plot 函数不陌生。画个正弦波、散点图&#xff0c;都得先准备好数据点 x 和 y &#xff0c;然后 plot(x, y) 。这很标准&#xff0c;但有时候也挺麻烦的。比如&a…

2026/8/29 17:57:37

小鹏 Iron 人形机器人:刷新物理 AI 融资纪录的惊艳之作

1. 引言&#xff1a;小鹏 Iron 创下物理 AI 融资新纪录 小鹏发布的人形机器人 Iron 近日完成了物理 AI 领域创纪录的融资。这一事件不仅让小鹏的机器人业务受到外界关注&#xff0c;也让“物理 AI”从一个技术概念加速走向资本与产业共同推动的新阶段。本文结合公开报道&#x…

2026/8/29 17:57:37

Jetson 实践—Robotics与Physical AI

一、本周学习内容 本周从“单独运行 AI 模型”进一步走向“让 AI 影响真实世界”。主要任务包括&#xff1a; 理解机器人系统和具身智能的基本概念。 掌握 ROS/ROS 2 的基本架构与通信方式。 理解 Physical AI 的感知、决策、执行和反馈闭环。 了解视觉模型在 Jetson 上的优…

2026/8/29 17:52:37

房室模型在气体传感器响应分析中的数学建模与应用

1. 项目概述&#xff1a;从“房室”到“传感器”的数学桥梁看到这个标题&#xff0c;很多同学可能会有点懵&#xff1a;房室模型&#xff1f;那不是药代动力学里用来描述药物在人体内吸收、分布、代谢、排泄的经典工具吗&#xff1f;气体传感器响应分析&#xff0c;听起来更像是…

2026/8/28 16:16:17

[光学原理与应用-521]:对光的错误理解与纠偏

首先光是一种能量的载体和形态&#xff0c;宏观上观察到的光是由无数个微观的光量子组成的&#xff0c;每个光子在产生的瞬间&#xff0c;其在真空的空间中以确定不变的速度沿着一个初始的方向一直向前&#xff0c;在微观层面&#xff0c;每个光量子的运动轨迹是以波函数所展现…

2026/8/28 16:16:21

SIP通话转接原理与REFER方法实战解析

1. 通话转接不是“挂断再拨号”&#xff0c;而是SIP会话的动态重定向你有没有遇到过这样的场景&#xff1a;客服坐席A正在和客户通电话&#xff0c;突然需要把这通对话无缝转给专家坐席B&#xff0c;客户完全感知不到中间的断连——既没听到忙音&#xff0c;也没被要求重新拨号…

2026/8/28 16:16:22

Kolla-ansible单节点OpenStack部署实战:从环境准备到排坑指南

1. 为什么选择Kolla-ansible来部署单节点OpenStack&#xff1f;如果你正在寻找一种能把OpenStack从“概念”快速变成“可用的实验环境”的方法&#xff0c;那么Kolla-ansible几乎是当前最主流、最省心的选择。我见过太多人卡在手动编译依赖、配置服务、处理版本冲突的泥潭里&am…

2026/8/29 0:01:10

etc目录下的profile.d文件目录设置环境变量和全局脚本shell

一、设置环境变量etc目录下的profile.d文件目录 /etc/profile.d1、编写 vi test.sh文件内容# jdk变量 export ZHK_HOME/root export PATH$PATH:$ZHK_HOME/test # 可以取出来ZHK_HOME变量给ZZZ_HOME赋值 export ZZZ_HOME${ZHK_HOME}/test2、刷新 执行source /etc/profile 命令使…

2026/8/29 0:01:10

【JavaScript】内存管理-垃圾回收机制-内存泄露

内存管理 C 语言这样的底层语言一般都有底层的内存管理接口&#xff0c;比如 malloc()和free()。 而 JavaScript 是在创建变量&#xff08;对象&#xff0c;字符串等&#xff09;时自动进行了分配内存&#xff0c;并且在不使用它们时“自动”释放。释放的过程称为垃圾回收。 整…

2026/8/29 0:01:10

Labgrid-MCP:为嵌入式硬件实验室接入AI Agent操控能力

Labgrid-MCP 的目标是把 MCP&#xff08;Model Context Protocol&#xff09;能力延伸到真实嵌入式硬件实验室&#xff1a;AI Agent 通过一个标准化的 MCP Server&#xff0c;就能查看目标板状态、控制上电断电、复位开发板、读取串口日志&#xff0c;甚至执行镜像刷写。对于经…

2026/8/28 16:16:48

实测才敢推 AI论文网站 2026最新测评与推荐

2026年真正好用的AI论文网站&#xff0c;核心看生成的论文质量、低AI味、格式正确、学术适配四大指标。综合实测&#xff0c;千笔AI、ThouPen、豆包、DeepSeek、Grammarly 是当前最值得推荐的梯队&#xff0c;覆盖从免费到付费、从中文到英文、从文科到理工的全场景需求。一、综…

2026/8/28 16:16:50

2026必备!AI论文网站测评:最新推荐与深度对比

2026年真正好用的AI论文网站&#xff0c;核心看生成的论文质量、低AI味、格式正确、学术适配四大指标。综合实测&#xff0c;千笔AI、ThouPen、豆包、DeepSeek、Grammarly 是当前最值得推荐的梯队&#xff0c;覆盖从免费到付费、从中文到英文、从文科到理工的全场景需求。 一、…

2026/8/28 11:06:45

摆脱论文困扰!盘点2026年全网爆红的的AI论文写作工具

一天写完毕业论文在2026年已不再是天方夜谭。2026年最炸裂、实测能大幅提速的AI论文写作工具&#xff0c;覆盖选题构思、文献整理、内容生成、格式排版等核心场景&#xff0c;真正帮你高效搞定论文难题。 一、全流程王者&#xff1a;一站式搞定论文全链路&#xff08;一天定稿首…