RMVL  1.4.0-dev
Robotic Manipulation and Vision Library
载入中...
搜索中...
未找到
RMVL 核心模块
RMVL 核心模块 的协作图:

专题

 数据读写(I/O)
 
 数据结构
 包含自定义的容器适配器以及其余数据结构
 
 卡尔曼滤波模块
 使用 cv::Matx 改写的轻量级卡尔曼滤波和扩展卡尔曼滤波模块
 
 数值计算模块
 包含函数插值、曲线拟合、非线性方程(组)数值解、常微分方程数值解等数值计算算法
 
 最优化算法库
 包含一维函数最小值搜索、无约束多维函数最小值搜索等最优化算法
 
 图像预处理模块
 提供了二值化等图像预处理功能
 
 串口通信模块
 基于 GNU C <termios.h> 的串行接口通信
 
 定时、计时模块
 

命名空间

namespace  rm::numeric_literals
 

class  rm::EwTopsis< Tp >
 熵权 TOPSIS 算法 更多...
 
class  rm::Exception
 该类封装了有关程序中发生的错误的所有或几乎所有必要信息。异常通常是通过 RMVL_Error 和 RMVL_Error_ 宏隐式构造和抛出的 更多...
 
struct  rm::hash_aggregate< Tp, Enable >
 专为聚合类添加的 hash 生成可调用对象 更多...
 
struct  rm::hash_traits< Tp, Enable >
 哈希生成函数类型 traits 更多...
 
struct  rm::hash_traits< Tp, std::enable_if_t<!std::is_aggregate_v< Tp > > >
 非聚合类哈希生成函数类型 traits 更多...
 
struct  rm::hash_traits< Tp, std::enable_if_t< std::is_aggregate_v< Tp > > >
 聚合类哈希生成函数类型 traits 更多...
 

宏定义

#define __RMVL_CAT__(x, y)
 
#define __RMVL_CAT_(x, y)
 
#define __RMVL_CAT(x, y)
 
#define __RMVL_EXPAND(x)
 
#define RMVL_Func   "<unknown>"
 
#define HIGHLIGHT_(...)
 
#define WARNING_(...)
 
#define PASS_(...)
 
#define ERROR_(...)
 
#define INFO_(...)
 
#define DEBUG_WARNING_(...)
 
#define DEBUG_ERROR_(...)
 
#define DEBUG_HIGHLIGHT_(...)
 
#define DEBUG_INFO_(...)
 
#define DEBUG_PASS_(...)
 
#define RMVL_ERRHANDLE(...)
 
#define RMVL_Error(code, msg)
 调用错误处理程序
 
#define RMVL_Error_(code, fmt, ...)
 调用错误处理程序
 
#define RMVL_Assert(expr)
 在运行时检查条件,如果失败则抛出异常
 
#define RMVL_DbgAssert(expr)
 在 Debug 条件下或启用静态分析工具的情况下,在运行时检查条件,如果失败则抛出异常
 

类型定义

using cv::Matx11f = Matx<float, 1, 1>
 
using cv::Matx11d = Matx<double, 1, 1>
 
using cv::Matx51f = Matx<float, 5, 1>
 
using cv::Matx15f = Matx<float, 1, 5>
 
using cv::Matx51d = Matx<double, 5, 1>
 
using cv::Matx15d = Matx<double, 1, 5>
 
using cv::Matx55f = Matx<float, 5, 5>
 
using cv::Matx55d = Matx<double, 5, 5>
 

枚举

enum  rm::AngleMode : bool { rm::RAD = true , rm::DEG = false }
 角度制式 更多...
 
enum class  rm::CalPlane : uint8_t { rm::CalPlane::xyz = 0 , rm::CalPlane::xOy = 1 , rm::CalPlane::xOz = 2 , rm::CalPlane::yOz = 3 }
 计算所在平面 更多...
 
enum  rm::EulerAxis : int { rm::X = 0 , rm::Y = 1 , rm::Z = 2 }
 欧拉角转轴枚举 更多...
 
enum  RMVLErrorCode : int {
  RMVL_StsOk = 0 , RMVL_StsBackTrace = -1 , RMVL_StsError = -2 , RMVL_StsNoMem = -3 ,
  RMVL_StsBadArg = -4 , RMVL_StsBadSize = -5 , RMVL_StsNullPtr = -6 , RMVL_StsNotaNumber = -7 ,
  RMVL_StsDivByZero = -8 , RMVL_StsOutOfRange = -9 , RMVL_StsAssert = -10 , RMVL_StsInvFmt = -11 ,
  RMVL_BadDynamicType = -12
}
 RMVL 错误码 更多...
 

函数

constexpr double rm::numeric_literals::operator""_PI (long double num)
 
constexpr double rm::numeric_literals::operator""_PI (long long unsigned num)
 
constexpr double rm::numeric_literals::operator""_to_rad (long double num)
 
constexpr double rm::numeric_literals::operator""_to_rad (long long unsigned num)
 
constexpr double rm::numeric_literals::operator""_to_deg (long double num)
 
constexpr double rm::numeric_literals::operator""_to_deg (long long unsigned num)
 
template<typename Tp >
constexpr Tp rm::operator+ (Tp val, const cv::Matx< Tp, 1, 1 > &mat)
 
template<typename Tp >
constexpr cv::Matx< Tp, 1, 1 > rm::operator+ (const cv::Matx< Tp, 1, 1 > &mat, Tp val)
 
template<typename Tp >
constexpr Tp rm::operator- (Tp val, const cv::Matx< Tp, 1, 1 > &mat)
 
template<typename Tp >
constexpr cv::Matx< Tp, 1, 1 > rm::operator- (const cv::Matx< Tp, 1, 1 > &mat, Tp val)
 
template<typename Tp >
constexpr Tp rm::deg2rad (Tp deg)
 角度转换为弧度
 
template<typename Tp >
constexpr Tp rm::rad2deg (Tp rad)
 弧度转换为角度
 
template<typename Tp >
constexpr cv::Matx< Tp, 3, 1 > rm::point2matx (cv::Point3_< Tp > point)
 Point 类型转换为 Matx 类型
 
template<typename Tp >
constexpr cv::Point3_< Tp > rm::matx2point (cv::Matx< Tp, 3, 1 > matx)
 Matx 类型转换为 Point 类型
 
template<typename Tp >
constexpr cv::Vec< Tp, 3 > rm::matx2vec (cv::Matx< Tp, 3, 1 > matx)
 Matx 类型转换为 Vec 类型
 
template<typename Tp1 , typename Tp2 >
constexpr auto rm::getDistance (const cv::Point_< Tp1 > &pt_1, const cv::Point_< Tp2 > &pt_2)
 获取距离
 
template<typename Tp1 , typename Tp2 >
constexpr auto rm::getDistance (const cv::Vec< Tp1, 2 > &vec_1, const cv::Vec< Tp2, 2 > &vec_2)
 获取距离
 
template<typename Tp1 , typename Tp2 >
constexpr auto rm::getDistance (const cv::Point3_< Tp1 > &pt_1, const cv::Point3_< Tp2 > &pt_2, CalPlane calplane=CalPlane::xyz)
 获取距离
 
template<typename Tp1 , typename Tp2 >
constexpr auto rm::getDistance (const cv::Vec< Tp1, 3 > &vec_1, const cv::Vec< Tp2, 3 > &vec_2, CalPlane calplane=CalPlane::xyz)
 获取距离
 
template<typename Tp1 , typename Tp2 >
constexpr auto rm::getDistance (const cv::Vec< Tp1, 4 > &line, const cv::Point_< Tp2 > &pt, bool direc=true)
 点到直线距离
 
template<typename Tp1 , typename Tp2 >
constexpr auto rm::getHAngle (const cv::Point_< Tp1 > &start, const cv::Point_< Tp2 > &end, AngleMode mode=RAD)
 获取与水平方向的夹角,以平面直角坐标系 x 轴为分界线, 逆时针为正方向,范围: (-180°, 180°],默认返回弧度制
 
template<typename Tp1 , typename Tp2 >
constexpr auto rm::getVAngle (const cv::Point_< Tp1 > &start, const cv::Point_< Tp2 > &end, AngleMode mode=RAD)
 获取与垂直方向的夹角,以平面直角坐标系 y 轴为分界线, 顺时针为正方向,范围: (-180°, 180°],默认返回弧度制
 
template<typename Tp >
constexpr Tp rm::getDeltaAngle (Tp angle_1, Tp angle_2)
 求两个角之间的夹角
 
template<typename Tp >
constexpr Tp rm::sec (Tp x)
 正割 \(\sec(x)\)
 
template<typename Tp >
constexpr Tp rm::csc (Tp x)
 余割 \(\csc(x)\)
 
template<typename Tp >
constexpr Tp rm::cot (Tp x)
 余切 \(\cot(x)\)
 
template<typename Tp >
constexpr Tp rm::sgn (Tp x)
 符号函数
 
template<typename Tp >
constexpr Tp rm::sigmoid (Tp x, Tp k=1, Tp Kp=1, Tp mu=0)
 计算 sigmoid(x) 在某一点的函数值
 
template<typename Tp >
constexpr Tp rm::cross2D (const cv::Vec< Tp, 2 > &a, const cv::Vec< Tp, 2 > &b)
 平面向量外积
 
template<typename Tp >
constexpr Tp rm::cross2D (const cv::Point_< Tp > &a, const cv::Point_< Tp > &b)
 平面向量外积
 
template<typename ForwardIterator >
ForwardIterator::value_type rm::calculateModeNum (ForwardIterator first, ForwardIterator last)
 在指定范围内寻找众数,时间复杂度 O(N)
 
template<typename T >
std::vector< T > rm::operator+ (const std::vector< T > &vec1, const std::vector< T > &vec2)
 使用 std::vector 表示的向量加法
 
template<typename T >
std::vector< T > rm::operator- (const std::vector< T > &vec1, const std::vector< T > &vec2)
 使用 std::vector 表示的向量减法
 
template<typename T >
std::vector< T > & rm::operator+= (std::vector< T > &vec1, const std::vector< T > &vec2)
 使用 std::vector 表示的向量自加
 
template<typename T >
std::vector< T > & rm::operator-= (std::vector< T > &vec1, const std::vector< T > &vec2)
 使用 std::vector 表示的向量自减
 
template<typename T >
std::vector< T > rm::operator- (const std::vector< T > &vec)
 使用 std::vector 表示的向量取反
 
template<typename T >
std::vector< T > rm::operator* (const std::vector< T > &vec, T val)
 使用 std::vector 表示的向量乘法(数乘)
 
template<typename T >
std::vector< T > rm::operator* (T val, const std::vector< T > &vec)
 使用 std::vector 表示的向量乘法(数乘)
 
template<typename T >
std::vector< T > & rm::operator*= (std::vector< T > &vec, T val)
 使用 std::vector 表示的向量乘法(数乘)
 
template<typename T >
std::vector< T > rm::operator/ (const std::vector< T > &vec, T val)
 使用 std::vector 表示的向量除法(数乘)
 
template<typename T >
std::vector< T > & rm::operator/= (std::vector< T > &vec, T val)
 使用 std::vector 表示的向量除法(数乘)
 
cv::Point2f rm::calculateRelativeAngle (const cv::Matx33f &cameraMatrix, cv::Point2f center)
 计算相机中心与目标中心之间的相对角度
 
cv::Point2f rm::calculateRelativeCenter (const cv::Matx33f &cameraMatrix, cv::Point2f angle)
 计算目标中心在像素坐标系下的坐标
 
cv::Vec2f rm::cameraConvertToPixel (const cv::Matx33f &cameraMatrix, const cv::Matx51f &distCoeffs, const cv::Vec3f &center3d)
 计算 3D 目标点在像素坐标系下的坐标
 
cv::Point2f rm::cameraConvertToPixel (const cv::Matx33f &cameraMatrix, const cv::Matx51f &distCoeffs, const cv::Point3f &center3d)
 计算 3D 目标点在像素坐标系下的坐标
 
template<typename Tp >
cv::Matx< Tp, 3, 3 > rm::euler2Mat (Tp val, EulerAxis axis)
 欧拉角转换为旋转矩阵
 
std::string rm::format (const char *fmt,...)
 返回使用类 printf 表达式格式化的文本字符串。
 
void rm::breakOnError ()
 触发非法内存操作
 
void rm::throwError (const Exception &exc)
 抛出异常
 
void rm::error (int _code, std::string_view _err, const char *_func, const char *_file, int _line)
 发出错误信号并引发异常
 
const char * rm::getBuildInformation ()
 返回完整的配置输出
 
template<typename Tp >
consteval std::size_t rm::reflect::size (auto &&...args)
 获取指定类型的成员个数
 
template<typename Tp , typename Callable >
void rm::reflect::for_each (Tp &&val, Callable &&f)
 遍历聚合类的每一个数据成员
 
template<typename Tp >
bool rm::reflect::equal (const Tp &lhs, const Tp &rhs)
 判断两个聚合类数据是否相同
 

变量

constexpr double rm::PI = ::std::numbers::pi
 圆周率: \(\pi\)
 
constexpr double rm::e = ::std::numbers::e
 自然对数底数: \(e\)
 
constexpr double rm::SQRT_2 = ::std::numbers::sqrt2
 根号 2: \(\sqrt2\)
 
constexpr double rm::PI_2 = PI / 2.
 PI / 2: \(\frac\pi2\)
 
constexpr double rm::PI_4 = PI / 4.
 PI / 4: \(\frac\pi4\)
 

详细描述

宏定义说明

◆ __RMVL_CAT

#define __RMVL_CAT ( x,
y )

#include <rmvl/core/rmvldef.hpp>

值:
#define __RMVL_CAT_(x, y)
定义 rmvldef.hpp:19

◆ __RMVL_CAT_

#define __RMVL_CAT_ ( x,
y )

#include <rmvl/core/rmvldef.hpp>

值:
#define __RMVL_CAT__(x, y)
定义 rmvldef.hpp:18

◆ __RMVL_CAT__

#define __RMVL_CAT__ ( x,
y )

#include <rmvl/core/rmvldef.hpp>

值:
x##y

◆ __RMVL_EXPAND

#define __RMVL_EXPAND ( x)

#include <rmvl/core/rmvldef.hpp>

值:
x

◆ DEBUG_ERROR_

#define DEBUG_ERROR_ ( ...)

#include <rmvl/core/util.hpp>

值:
ERROR_(__VA_ARGS__)
#define ERROR_(...)
定义 util.hpp:50

◆ DEBUG_HIGHLIGHT_

#define DEBUG_HIGHLIGHT_ ( ...)

#include <rmvl/core/util.hpp>

值:
HIGHLIGHT_(__VA_ARGS__)
#define HIGHLIGHT_(...)
定义 util.hpp:29

◆ DEBUG_INFO_

#define DEBUG_INFO_ ( ...)

#include <rmvl/core/util.hpp>

值:
INFO_(__VA_ARGS__)
#define INFO_(...)
定义 util.hpp:57

◆ DEBUG_PASS_

#define DEBUG_PASS_ ( ...)

#include <rmvl/core/util.hpp>

值:
PASS_(__VA_ARGS__)
#define PASS_(...)
定义 util.hpp:43

◆ DEBUG_WARNING_

#define DEBUG_WARNING_ ( ...)

#include <rmvl/core/util.hpp>

值:
WARNING_(__VA_ARGS__)
#define WARNING_(...)
定义 util.hpp:36

◆ ERROR_

#define ERROR_ ( ...)

◆ HIGHLIGHT_

#define HIGHLIGHT_ ( ...)

#include <rmvl/core/util.hpp>

值:
do \
{ \
printf("\033[35minfo - \033[0m" __VA_ARGS__); \
printf("\n"); \
} while (false)

◆ INFO_

#define INFO_ ( ...)

#include <rmvl/core/util.hpp>

值:
do \
{ \
printf("info - " __VA_ARGS__); \
printf("\n"); \
} while (false)
示例
samples/camera/hik/sample_hik_multi.cpp, samples/detector/hik/sample_hik_armor_collection.cpp , 以及 samples/detector/mv/sample_mv_armor_collection.cpp.

◆ PASS_

#define PASS_ ( ...)

#include <rmvl/core/util.hpp>

值:
do \
{ \
printf("\033[32minfo - \033[0m" __VA_ARGS__); \
printf("\n"); \
} while (false)
示例
samples/detector/hik/sample_hik_armor_collection.cpp , 以及 samples/detector/mv/sample_mv_armor_collection.cpp.

◆ RMVL_Assert

#define RMVL_Assert ( expr)

#include <rmvl/core/util.hpp>

值:
(!!(expr)) ? (void(0)) : rm::error(RMVL_StsAssert, #expr, RMVL_Func, __FILE__, __LINE__)
void error(int _code, std::string_view _err, const char *_func, const char *_file, int _line)
发出错误信号并引发异常
#define RMVL_Func
定义 rmvldef.hpp:44
@ RMVL_StsAssert
断言失败 Assertion failed
定义 util.hpp:91

在运行时检查条件,如果失败则抛出异常

注解
宏 RMVL_Assert (以及 RMVL_DbgAssert) 对指定的表达式求值。如果它是0,宏抛出一个错误。宏 RMVL_Assert 将会在 Debug 和 Release 的配置下检查条件,而 RMVL_DbgAssert 只会在 Debug 的配置下生效。
参见
RMVLErrorCode
示例
samples/tutorial_code/dataio/sample_write_corners.cpp.

◆ RMVL_DbgAssert

#define RMVL_DbgAssert ( expr)

#include <rmvl/core/util.hpp>

值:
#define RMVL_Assert(expr)
在运行时检查条件,如果失败则抛出异常
定义 util.hpp:230

在 Debug 条件下或启用静态分析工具的情况下,在运行时检查条件,如果失败则抛出异常

◆ RMVL_ERRHANDLE

#define RMVL_ERRHANDLE ( ...)

#include <rmvl/core/util.hpp>

值:
breakOnError()

◆ RMVL_Error

#define RMVL_Error ( code,
msg )

#include <rmvl/core/util.hpp>

值:
rm::error(code, msg, RMVL_Func, __FILE__, __LINE__)

调用错误处理程序

注解
目前,错误处理程序将错误代码和错误消息打印到标准错误流 stderr。在 Debug 配置中,它会引发内存访问冲突,以便调试器可以分析执行堆栈和所有参数。在 Release 配置中,抛出异常。
参数
[in]code一种 RMVLErrorCode 错误码
[in]msg错误信息
示例
samples/camera/mv/sample_mv_auto_calib.cpp, samples/detector/hik/sample_hik_armor_collection.cpp, samples/detector/hik/sample_hik_armor_size_classify.cpp, samples/detector/mv/sample_mv_armor_collection.cpp , 以及 samples/detector/mv/sample_mv_armor_size_classify.cpp.

◆ RMVL_Error_

#define RMVL_Error_ ( code,
fmt,
... )

#include <rmvl/core/util.hpp>

值:
rm::error(code, rm::format(fmt, __VA_ARGS__), RMVL_Func, __FILE__, __LINE__)
std::string format(const char *fmt,...)
返回使用类 printf 表达式格式化的文本字符串。

调用错误处理程序

注解
该宏可用于动态构造错误消息,以包含一些动态信息,例如
// 请注意格式化文本消息周围的额外括号
RMVL_Error_(RMVL_StsBadArg, "Bad channel of the input argument: \"input_image\", chn = %d", C);
#define RMVL_Error_(code, fmt,...)
调用错误处理程序
定义 util.hpp:221
@ RMVL_StsBadArg
参数异常 Bad argument
定义 util.hpp:85
参数
[in]code一种 RMVLErrorCode 错误码
[in]fmt格式化字符串
[in]...括号中带有类似 printf 格式的错误信息

◆ RMVL_Func

#define RMVL_Func   "<unknown>"

◆ WARNING_

#define WARNING_ ( ...)

类型定义说明

◆ Matx11d

using cv::Matx11d = Matx<double, 1, 1>

#include <rmvl/core/math.hpp>

◆ Matx11f

using cv::Matx11f = Matx<float, 1, 1>

#include <rmvl/core/math.hpp>

◆ Matx15d

using cv::Matx15d = Matx<double, 1, 5>

#include <rmvl/core/math.hpp>

◆ Matx15f

using cv::Matx15f = Matx<float, 1, 5>

#include <rmvl/core/math.hpp>

◆ Matx51d

using cv::Matx51d = Matx<double, 5, 1>

#include <rmvl/core/math.hpp>

◆ Matx51f

using cv::Matx51f = Matx<float, 5, 1>

#include <rmvl/core/math.hpp>

◆ Matx55d

using cv::Matx55d = Matx<double, 5, 5>

#include <rmvl/core/math.hpp>

◆ Matx55f

using cv::Matx55f = Matx<float, 5, 5>

#include <rmvl/core/math.hpp>

枚举类型说明

◆ AngleMode

enum rm::AngleMode : bool

#include <rmvl/core/math.hpp>

角度制式

枚举值
RAD 

弧度制

DEG 

角度制

◆ CalPlane

enum class rm::CalPlane : uint8_t
strong

#include <rmvl/core/math.hpp>

计算所在平面

枚举值
xyz 

三维空间

xOy 

xOy平面

xOz 

xOz平面

yOz 

yOz平面

◆ EulerAxis

enum rm::EulerAxis : int

#include <rmvl/core/transform.hpp>

欧拉角转轴枚举

枚举值

X 轴

Y 轴

Z 轴

◆ RMVLErrorCode

enum RMVLErrorCode : int

#include <rmvl/core/util.hpp>

RMVL 错误码

枚举值
RMVL_StsOk 

没有错误 No Error

RMVL_StsBackTrace 

回溯 Backtrace

RMVL_StsError 

未指定(未知)错误 Unspecified (Unknown) error

RMVL_StsNoMem 

内存不足 Insufficient memory

RMVL_StsBadArg 

参数异常 Bad argument

RMVL_StsBadSize 

数组大小不正确 Incorrect size of the array

RMVL_StsNullPtr 

空指针 Null pointer

RMVL_StsNotaNumber 

非数 Not a Number (nan)

RMVL_StsDivByZero 

发生了除以 0 的情况 Division by zero occurred

RMVL_StsOutOfRange 

其中一个参数的值超出了范围 One of the arguments' values is out of range

RMVL_StsAssert 

断言失败 Assertion failed

RMVL_StsInvFmt 

无效格式 Invalid format

RMVL_BadDynamicType 

动态类型转换错误 Bad dynamic_cast type

函数说明

◆ breakOnError()

void rm::breakOnError ( )
inline

#include <rmvl/core/util.hpp>

触发非法内存操作

注解
当调用该函数时,默认错误处理程序会发出一个硬件异常,这可以使调试更加方便

◆ calculateModeNum()

template<typename ForwardIterator >
ForwardIterator::value_type rm::calculateModeNum ( ForwardIterator first,
ForwardIterator last )

#include <rmvl/core/math.hpp>

在指定范围内寻找众数,时间复杂度 O(N)

模板参数
ForwardIterator前向迭代器
参数
[in]first起始迭代器
[in]last终止迭代器
返回
众数

◆ calculateRelativeAngle()

cv::Point2f rm::calculateRelativeAngle ( const cv::Matx33f & cameraMatrix,
cv::Point2f center )

#include <rmvl/core/transform.hpp>

计算相机中心与目标中心之间的相对角度

注解
公式推导参考函数 calculateRelativeCenter() ,现直接给出结果

\[\begin{bmatrix} \tan{yaw}\\\tan{pitch}\\1\end{bmatrix}=\begin{bmatrix}f_x&0&u_0\\0&f_y&v_0\\0&0&1 \end{bmatrix}^{-1}\begin{bmatrix}u\\v\\1\end{bmatrix}\]

参数
[in]cameraMatrix相机内参矩阵
[in]center像素坐标系下的目标中心
返回
相对角度,目标在图像右方,point.x 为正,目标在图像下方,point.y 为正

◆ calculateRelativeCenter()

cv::Point2f rm::calculateRelativeCenter ( const cv::Matx33f & cameraMatrix,
cv::Point2f angle )

#include <rmvl/core/transform.hpp>

计算目标中心在像素坐标系下的坐标

注解
由针孔相机模型中的相似三角形关系推出下列公式,其中 \((u, v)\) 为像素坐标系下的坐标, \((X, Y, Z)\) 为相机坐标系下的坐标

\[u=f_x\frac XZ+u_0=f_x\tan{yaw}+u_0\]

\[v=f_y \frac YZ+v_0=f_y\tan{pitch}+v_0\]

写成矩阵相乘的方式:

\[\begin{bmatrix}u\\v\\1 \end{bmatrix}=\frac1Z\begin{bmatrix}f_x&0&u_0\\0&f_y&v_0\\0&0&1\end{bmatrix} \begin{bmatrix}X\\Y\\Z\end{bmatrix}=\begin{bmatrix}f_x&0&u_0\\0&f_y&v_0\\0&0&1 \end{bmatrix}\begin{bmatrix}\tan{yaw}\\\tan{pitch}\\1\end{bmatrix}\]

参数
[in]cameraMatrix相机内参矩阵
[in]angle目标中心与相机中心的相对角度
返回
目标中心在像素坐标系下的坐标

◆ cameraConvertToPixel() [1/2]

cv::Point2f rm::cameraConvertToPixel ( const cv::Matx33f & cameraMatrix,
const cv::Matx51f & distCoeffs,
const cv::Point3f & center3d )
inline

#include <rmvl/core/transform.hpp>

计算 3D 目标点在像素坐标系下的坐标

参数
[in]cameraMatrix相机内参矩阵
[in]distCoeffs相机畸变参数
[in]center3d目标点在相机坐标系下的坐标
返回
目标点在像素坐标系下的坐标
函数调用图:

◆ cameraConvertToPixel() [2/2]

cv::Vec2f rm::cameraConvertToPixel ( const cv::Matx33f & cameraMatrix,
const cv::Matx51f & distCoeffs,
const cv::Vec3f & center3d )

#include <rmvl/core/transform.hpp>

计算 3D 目标点在像素坐标系下的坐标

参数
[in]cameraMatrix相机内参矩阵
[in]distCoeffs相机畸变参数
[in]center3d目标点在相机坐标系下的坐标
返回
目标点在像素坐标系下的坐标

◆ cot()

template<typename Tp >
Tp rm::cot ( Tp x)
constexpr

#include <rmvl/core/math.hpp>

余切 \(\cot(x)\)

模板参数
Tp变量类型
参数
[in]x自变量
返回
cot(x)

◆ cross2D() [1/2]

template<typename Tp >
Tp rm::cross2D ( const cv::Point_< Tp > & a,
const cv::Point_< Tp > & b )
constexpr

#include <rmvl/core/math.hpp>

平面向量外积

模板参数
TpPoint_数据类型
参数
[in]a向量 A
[in]b向量 B
返回
外积,若 retval = 0,则共线

◆ cross2D() [2/2]

template<typename Tp >
Tp rm::cross2D ( const cv::Vec< Tp, 2 > & a,
const cv::Vec< Tp, 2 > & b )
constexpr

#include <rmvl/core/math.hpp>

平面向量外积

模板参数
Tp向量数据类型
参数
[in]a向量 A
[in]b向量 B
返回
外积,若 retval = 0,则共线

◆ csc()

template<typename Tp >
Tp rm::csc ( Tp x)
constexpr

#include <rmvl/core/math.hpp>

余割 \(\csc(x)\)

模板参数
Tp变量类型
参数
[in]x自变量
返回
csc(x)

◆ deg2rad()

template<typename Tp >
Tp rm::deg2rad ( Tp deg)
constexpr

#include <rmvl/core/math.hpp>

角度转换为弧度

模板参数
Tp变量类型
参数
[in]deg角度
返回
弧度

◆ equal()

template<typename Tp >
bool rm::reflect::equal ( const Tp & lhs,
const Tp & rhs )
inline

#include <rmvl/core/util.hpp>

判断两个聚合类数据是否相同

注解
成员个数不要超过 12
模板参数
Tp聚合类类型
参数
[in]lhs左操作数
[in]rhs右操作数
函数调用图:

◆ error()

void rm::error ( int _code,
std::string_view _err,
const char * _func,
const char * _file,
int _line )

#include <rmvl/core/util.hpp>

发出错误信号并引发异常

注解
该函数将错误信息打印到 stderr
参数
[in]_code错误码
[in]_err错误描述
[in]_func函数名,仅在编译器支持获取时可用
[in]_file发生错误的源文件名
[in]_line源文件中发生错误的行号
参见
RMVL_Error, RMVL_Error_, RMVL_Assert

◆ euler2Mat()

template<typename Tp >
cv::Matx< Tp, 3, 3 > rm::euler2Mat ( Tp val,
EulerAxis axis )
inline

#include <rmvl/core/transform.hpp>

欧拉角转换为旋转矩阵

模板参数
Tp数据类型
参数
[in]val角度数值(弧度制)
[in]axis转轴
返回
Matx 格式的旋转矩阵

◆ for_each()

template<typename Tp , typename Callable >
void rm::reflect::for_each ( Tp && val,
Callable && f )
inline

#include <rmvl/core/util.hpp>

遍历聚合类的每一个数据成员

注解
成员个数不要超过 12
模板参数
Tp聚合类类型
Callable可调用对象类型
参数
[in]val聚合类对象
[in]f可调用对象
函数调用图:

◆ format()

std::string rm::format ( const char * fmt,
... )

#include <rmvl/core/util.hpp>

返回使用类 printf 表达式格式化的文本字符串。

注解
该函数的作用类似于 sprintf,但形成并返回一个 STL 字符串。它可用于在 Exception 构造函数中形成错误消息。
参数
[in]fmtprintf 兼容的格式化说明符。
类型 限定符
const char* s
char c
float or double f,g
int, long, long long d, ld, `lld
unsigned, unsigned long, unsigned long long u, lu, llu
uint64_t \(\to\) uintmax_t, int64_t \(\to\) intmax_t ju, jd
size_t zu

◆ getBuildInformation()

const char * rm::getBuildInformation ( )

#include <rmvl/core/util.hpp>

返回完整的配置输出

返回
原始的 CMake 输出,包括版本控制系统修订,编译器版本,编译器标志,启用的模块和第三方库等。
返回值
配置、构建信息字符串

◆ getDeltaAngle()

template<typename Tp >
Tp rm::getDeltaAngle ( Tp angle_1,
Tp angle_2 )
constexpr

#include <rmvl/core/math.hpp>

求两个角之间的夹角

模板参数
Tp角度的数据类型
参数
[in]angle_1第 1 个角度
[in]angle_2第 2 个角度
返回
夹角,角度的范围是 (-180°, 180°]

◆ getDistance() [1/5]

template<typename Tp1 , typename Tp2 >
auto rm::getDistance ( const cv::Point3_< Tp1 > & pt_1,
const cv::Point3_< Tp2 > & pt_2,
CalPlane calplane = CalPlane::xyz )
constexpr

#include <rmvl/core/math.hpp>

获取距离

模板参数
Tp1空间点 1 的数据类型
Tp2空间点 2 的数据类型
参数
[in]pt_1起始点
[in]pt_2终止点
[in]calplane要计算的距离所在的平面
返回
空间欧式距离

◆ getDistance() [2/5]

template<typename Tp1 , typename Tp2 >
auto rm::getDistance ( const cv::Point_< Tp1 > & pt_1,
const cv::Point_< Tp2 > & pt_2 )
constexpr

#include <rmvl/core/math.hpp>

获取距离

模板参数
Tp1平面点 1 的数据类型
Tp2平面点 2 的数据类型
参数
[in]pt_1起始点
[in]pt_2终止点
返回
平面欧式距离

◆ getDistance() [3/5]

template<typename Tp1 , typename Tp2 >
auto rm::getDistance ( const cv::Vec< Tp1, 2 > & vec_1,
const cv::Vec< Tp2, 2 > & vec_2 )
constexpr

#include <rmvl/core/math.hpp>

获取距离

模板参数
Tp1平面向量 1 的数据类型
Tp2平面向量 2 的数据类型
参数
[in]vec_1起始向量
[in]vec_2终止向量
返回
平面欧式距离

◆ getDistance() [4/5]

template<typename Tp1 , typename Tp2 >
auto rm::getDistance ( const cv::Vec< Tp1, 3 > & vec_1,
const cv::Vec< Tp2, 3 > & vec_2,
CalPlane calplane = CalPlane::xyz )
constexpr

#include <rmvl/core/math.hpp>

获取距离

模板参数
Tp1空间向量 1 的数据类型
Tp2空间向量 2 的数据类型
参数
[in]vec_1起始向量
[in]vec_2终止向量
[in]calplane要计算的距离所在的平面
返回
空间欧式距离
函数调用图:

◆ getDistance() [5/5]

template<typename Tp1 , typename Tp2 >
auto rm::getDistance ( const cv::Vec< Tp1, 4 > & line,
const cv::Point_< Tp2 > & pt,
bool direc = true )
constexpr

#include <rmvl/core/math.hpp>

点到直线距离

注解
点 \(P=(x_0,y_0)\) 到直线 \(l:Ax+By+C=0\) 距离公式为

\[D(P,l)=\frac{Ax_0+By_0+C}{\sqrt{A^2+B^2}}\]

模板参数
Tp1直线方程数据类型
Tp2平面点的数据类型
参数
[in]linecv::Vec4_ 表示的直线方程 (vx, vy, x0, y0)
[in]pt平面点
[in]direc是否区分距离的方向
注解
  • 计算结果有正负,即区分点在直线分布的方向,通过修改传入参数 direc = false 来设置计算结果不区分正负(统一返回 \(|D(P,l)|\))
  • line 需要传入元素为 \((v_x, v_y, x_0, y_0)\) 的用 cv::Vec4_ 表示的向量,指代下列直线方程(与 cv::fitLine 传入的 cv::Vec4_ 参数一致)

    \[l:y-y_0=\frac{v_y}{v_x}(x-x_0)\]

返回
平面欧式距离

◆ getHAngle()

template<typename Tp1 , typename Tp2 >
auto rm::getHAngle ( const cv::Point_< Tp1 > & start,
const cv::Point_< Tp2 > & end,
AngleMode mode = RAD )
constexpr

#include <rmvl/core/math.hpp>

获取与水平方向的夹角,以平面直角坐标系 x 轴为分界线, 逆时针为正方向,范围: (-180°, 180°],默认返回弧度制

模板参数
Tp1平面点 1 的数据类型
Tp2平面点 2 的数据类型
参数
[in]start像素坐标系下的起点
[in]end像素坐标系下的终点
[in]mode返回角度模式,默认弧度制
返回
返回角度
函数调用图:

◆ getVAngle()

template<typename Tp1 , typename Tp2 >
auto rm::getVAngle ( const cv::Point_< Tp1 > & start,
const cv::Point_< Tp2 > & end,
AngleMode mode = RAD )
constexpr

#include <rmvl/core/math.hpp>

获取与垂直方向的夹角,以平面直角坐标系 y 轴为分界线, 顺时针为正方向,范围: (-180°, 180°],默认返回弧度制

模板参数
Tp1平面点 1 的数据类型
Tp2平面点 2 的数据类型
参数
[in]start起点
[in]end终点
[in]mode返回角度模式,默认弧度制
返回
返回角度
函数调用图:

◆ matx2point()

template<typename Tp >
cv::Point3_< Tp > rm::matx2point ( cv::Matx< Tp, 3, 1 > matx)
constexpr

#include <rmvl/core/math.hpp>

Matx 类型转换为 Point 类型

模板参数
Tp数据类型
参数
[in]matxMatx 类型变量
返回
Point 类型变量

◆ matx2vec()

template<typename Tp >
cv::Vec< Tp, 3 > rm::matx2vec ( cv::Matx< Tp, 3, 1 > matx)
constexpr

#include <rmvl/core/math.hpp>

Matx 类型转换为 Vec 类型

模板参数
Tp数据类型
参数
[in]matxMatx 类型变量
返回
Vec 类型变量

◆ operator""_PI() [1/2]

double rm::numeric_literals::operator""_PI ( long double num)
constexpr

#include <rmvl/core/math.hpp>

◆ operator""_PI() [2/2]

double rm::numeric_literals::operator""_PI ( long long unsigned num)
constexpr

#include <rmvl/core/math.hpp>

◆ operator""_to_deg() [1/2]

double rm::numeric_literals::operator""_to_deg ( long double num)
constexpr

#include <rmvl/core/math.hpp>

◆ operator""_to_deg() [2/2]

double rm::numeric_literals::operator""_to_deg ( long long unsigned num)
constexpr

#include <rmvl/core/math.hpp>

◆ operator""_to_rad() [1/2]

double rm::numeric_literals::operator""_to_rad ( long double num)
constexpr

#include <rmvl/core/math.hpp>

◆ operator""_to_rad() [2/2]

double rm::numeric_literals::operator""_to_rad ( long long unsigned num)
constexpr

#include <rmvl/core/math.hpp>

◆ operator*() [1/2]

template<typename T >
std::vector< T > rm::operator* ( const std::vector< T > & vec,
T val )
inline

#include <rmvl/core/math.hpp>

使用 std::vector 表示的向量乘法(数乘)

模板参数
T数据类型
参数
[in]vec向量
[in]val数乘因子
返回
向量乘法(数乘)

◆ operator*() [2/2]

template<typename T >
std::vector< T > rm::operator* ( T val,
const std::vector< T > & vec )
inline

#include <rmvl/core/math.hpp>

使用 std::vector 表示的向量乘法(数乘)

模板参数
T数据类型
参数
[in]val数乘因子
[in]vec向量
返回
向量乘法(数乘)

◆ operator*=()

template<typename T >
std::vector< T > & rm::operator*= ( std::vector< T > & vec,
T val )
inline

#include <rmvl/core/math.hpp>

使用 std::vector 表示的向量乘法(数乘)

模板参数
T数据类型
参数
[in]vec向量
[in]val数乘因子
返回
向量乘法(数乘)

◆ operator+() [1/3]

template<typename Tp >
cv::Matx< Tp, 1, 1 > rm::operator+ ( const cv::Matx< Tp, 1, 1 > & mat,
Tp val )
constexpr

#include <rmvl/core/math.hpp>

◆ operator+() [2/3]

template<typename T >
std::vector< T > rm::operator+ ( const std::vector< T > & vec1,
const std::vector< T > & vec2 )
inline

#include <rmvl/core/math.hpp>

使用 std::vector 表示的向量加法

模板参数
T数据类型
参数
[in]vec1向量 1
[in]vec2向量 2
返回
和向量

◆ operator+() [3/3]

template<typename Tp >
Tp rm::operator+ ( Tp val,
const cv::Matx< Tp, 1, 1 > & mat )
constexpr

#include <rmvl/core/math.hpp>

◆ operator+=()

template<typename T >
std::vector< T > & rm::operator+= ( std::vector< T > & vec1,
const std::vector< T > & vec2 )
inline

#include <rmvl/core/math.hpp>

使用 std::vector 表示的向量自加

模板参数
T数据类型
参数
[in]vec1向量 1
[in]vec2向量 2
返回
和向量

◆ operator-() [1/4]

template<typename Tp >
cv::Matx< Tp, 1, 1 > rm::operator- ( const cv::Matx< Tp, 1, 1 > & mat,
Tp val )
constexpr

#include <rmvl/core/math.hpp>

◆ operator-() [2/4]

template<typename T >
std::vector< T > rm::operator- ( const std::vector< T > & vec)
inline

#include <rmvl/core/math.hpp>

使用 std::vector 表示的向量取反

模板参数
T数据类型
参数
[in]vec向量
返回
向量取反后的结果

◆ operator-() [3/4]

template<typename T >
std::vector< T > rm::operator- ( const std::vector< T > & vec1,
const std::vector< T > & vec2 )
inline

#include <rmvl/core/math.hpp>

使用 std::vector 表示的向量减法

模板参数
T数据类型
参数
[in]vec1向量 1
[in]vec2向量 2
返回
差向量

◆ operator-() [4/4]

template<typename Tp >
Tp rm::operator- ( Tp val,
const cv::Matx< Tp, 1, 1 > & mat )
constexpr

#include <rmvl/core/math.hpp>

◆ operator-=()

template<typename T >
std::vector< T > & rm::operator-= ( std::vector< T > & vec1,
const std::vector< T > & vec2 )
inline

#include <rmvl/core/math.hpp>

使用 std::vector 表示的向量自减

模板参数
T数据类型
参数
[in]vec1向量 1
[in]vec2向量 2
返回
差向量

◆ operator/()

template<typename T >
std::vector< T > rm::operator/ ( const std::vector< T > & vec,
T val )
inline

#include <rmvl/core/math.hpp>

使用 std::vector 表示的向量除法(数乘)

模板参数
T数据类型
参数
[in]vec向量
[in]val除数
返回
向量除法(数乘)

◆ operator/=()

template<typename T >
std::vector< T > & rm::operator/= ( std::vector< T > & vec,
T val )
inline

#include <rmvl/core/math.hpp>

使用 std::vector 表示的向量除法(数乘)

模板参数
T数据类型
参数
[in]val除数
[in]vec向量
返回
向量除法(数乘)

◆ point2matx()

template<typename Tp >
cv::Matx< Tp, 3, 1 > rm::point2matx ( cv::Point3_< Tp > point)
constexpr

#include <rmvl/core/math.hpp>

Point 类型转换为 Matx 类型

模板参数
Tp数据类型
参数
[in]pointPoint 类型变量
返回
Matx 类型变量

◆ rad2deg()

template<typename Tp >
Tp rm::rad2deg ( Tp rad)
constexpr

#include <rmvl/core/math.hpp>

弧度转换为角度

模板参数
Tp变量类型
参数
[in]rad弧度
返回
角度

◆ sec()

template<typename Tp >
Tp rm::sec ( Tp x)
constexpr

#include <rmvl/core/math.hpp>

正割 \(\sec(x)\)

模板参数
Tp变量类型
参数
[in]x自变量
返回
sec(x)

◆ sgn()

template<typename Tp >
Tp rm::sgn ( Tp x)
constexpr

#include <rmvl/core/math.hpp>

符号函数

模板参数
Tp变量类型
参数
[in]x自变量
返回

\[\text{sgn}(x)=\left\{\begin{matrix} 1&&x>0\\0&&x=0\\-1&&x<0 \end{matrix}\right.\]

◆ sigmoid()

template<typename Tp >
Tp rm::sigmoid ( Tp x,
Tp k = 1,
Tp Kp = 1,
Tp mu = 0 )
constexpr

#include <rmvl/core/math.hpp>

计算 sigmoid(x) 在某一点的函数值

注解
sigmoid 函数表达式为:

\[y=f_{sig}(x)=\frac{K_p}{1+e^{-kx+\mu}}\]

模板参数
Tp变量类型
参数
[in]x自变量 \(x\)
[in]k缩放系数 \(k\)
[in]Kp开环增益系数 \(K_p\)
[in]mu偏移系数 \(\mu\)
返回
函数值 \(f_{sig}(x)\)

◆ size()

template<typename Tp >
std::size_t rm::reflect::size ( auto &&... args)
consteval

#include <rmvl/core/util.hpp>

获取指定类型的成员个数

注解
成员个数不要超过 12
模板参数
Tp聚合类类型
返回
成员个数
函数调用图:

◆ throwError()

void rm::throwError ( const Exception & exc)
inline

#include <rmvl/core/util.hpp>

抛出异常

变量说明

◆ e

double rm::e = ::std::numbers::e
constexpr

#include <rmvl/core/math.hpp>

自然对数底数: \(e\)

◆ PI

double rm::PI = ::std::numbers::pi
constexpr

#include <rmvl/core/math.hpp>

圆周率: \(\pi\)

◆ PI_2

double rm::PI_2 = PI / 2.
constexpr

#include <rmvl/core/math.hpp>

PI / 2: \(\frac\pi2\)

◆ PI_4

double rm::PI_4 = PI / 4.
constexpr

#include <rmvl/core/math.hpp>

PI / 4: \(\frac\pi4\)

◆ SQRT_2

double rm::SQRT_2 = ::std::numbers::sqrt2
constexpr

#include <rmvl/core/math.hpp>

根号 2: \(\sqrt2\)