百度Apollo规划算法——OBB障碍物检测代码解析

2024-02-26 20:30

本文主要是介绍百度Apollo规划算法——OBB障碍物检测代码解析,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

百度Apollo规划算法——Box障碍物检测代码解析

  • 前言
  • 代码
  • 代码分析
    • f1
    • f2
    • f3
    • f4
    • f5
    • f6
  • 参考

前言

本文主要分析Apollo代码中函数bool Box::HasOverlap(const Box2d &box) const {}的数学原理。

在阅读此部分代码时,第一遍没看懂return的一堆什么意思,百度之后说是采用OBB原理,所以就去了解下OBB原理,回来看还是没太明白,直到看到了博客[1],通过博主的图解才有了进一步的了解,但对照代码还是没能完全理解,后来结合向量的相关知识,才算彻底明白了HasOverlap()实现的具体数学原理。
下面,作者仅对代码进行数学解读。

代码

直接上代码,代码路径/self_driving/Optimization/Apollo-DL-IAPS/util/box2d.cc,作者在这里将代码划分为几个部分分别解读。Apollo对Box2d的碰撞检测分为两步进行,第一步使用AABB进行粗检测(f1部分)快速剔除非碰撞的box,第二部分使用OBB进行细检测(f2~f6部分),对f1检测到有碰撞的box进一步进行检测。

bool Box2d::HasOverlap(const Box2d &box) const {// f1if (box.max_x() < min_x() || box.min_x() > max_x() || box.max_y() < min_y() ||box.min_y() > max_y()) {return false;}//f2const double shift_x = box.center_x() - center_.x();const double shift_y = box.center_y() - center_.y();const double dx1 = cos_heading_ * half_length_;const double dy1 = sin_heading_ * half_length_;const double dx2 = sin_heading_ * half_width_;const double dy2 = -cos_heading_ * half_width_;const double dx3 = box.cos_heading() * box.half_length();const double dy3 = box.sin_heading() * box.half_length();const double dx4 = box.sin_heading() * box.half_width();const double dy4 = -box.cos_heading() * box.half_width();//f3return std::abs(shift_x * cos_heading_ + shift_y * sin_heading_) <=std::abs(dx3 * cos_heading_ + dy3 * sin_heading_) +std::abs(dx4 * cos_heading_ + dy4 * sin_heading_) +half_length_ &&//f4std::abs(shift_x * sin_heading_ - shift_y * cos_heading_) <=std::abs(dx3 * sin_heading_ - dy3 * cos_heading_) +std::abs(dx4 * sin_heading_ - dy4 * cos_heading_) +half_width_ &&//f5std::abs(shift_x * box.cos_heading() + shift_y * box.sin_heading()) <=std::abs(dx1 * box.cos_heading() + dy1 * box.sin_heading()) +std::abs(dx2 * box.cos_heading() + dy2 * box.sin_heading()) +box.half_length() &&//f6std::abs(shift_x * box.sin_heading() - shift_y * box.cos_heading()) <=std::abs(dx1 * box.sin_heading() - dy1 * box.cos_heading()) +std::abs(dx2 * box.sin_heading() - dy2 * box.cos_heading()) +box.half_width();
}

代码分析

f1

AABB检测用于粗检测,根据自车和障碍物的box角点构建两个长宽分别平行于坐标轴的box,查看这两个box(两个虚线box表示)是否有交集,可以直接根据新构建的box的角点的坐标值来判断。如下图所示,通过这种方式可以粗略检测到A、B有碰撞,但是是否真的有碰撞还需要通过OBB进一步检测。
AABB

f2

根据OBB检测原理,构建向量如下图所示:
分离轴投影
假设有两个Box类型的对象A和B,计算A.HasOverlap(B)的结果。
以下两行代码计算的时A的中心到B的中心的向量

  const double shift_x = box.center_x() - center_.x();const double shift_y = box.center_y() - center_.y();

转换为数学计算为:
a b ⃗ = ( x s h i f t , y s h i f t ) = ( B . x c e n t e r − A . x c e n t e r , B . y c e n t e r − A . y c e n t e r ) (1) \vec{ab}=(x_{shift},y_{shift})=(B.x_{center}-A.x_{center},B.y_{center}-A.y_{center})\tag{1} ab =(xshift,yshift)=(B.xcenterA.xcenter,B.ycenterA.ycenter)(1)
以下四行代码是分别计算A的纵向方向(指box的朝向)和横向方向的两个向量,其中纵向方向的向量模为 l e n g t h h a l f length_{half} lengthhalf,横向方向的向量模为 w i d t h h a l f width_{half} widthhalf

  const double dx1 = cos_heading_ * half_length_;const double dy1 = sin_heading_ * half_length_;const double dx2 = sin_heading_ * half_width_;const double dy2 = -cos_heading_ * half_width_;

纵向向量:
v 1 ⃗ = ( d x 1 , d y 1 ) = A . l e n g t h h a l f ⋅ ( cos ⁡ ( h e a d i n g A ) , sin ⁡ ( h e a d i n g A ) ) (2) \vec{v_1}=(dx1,dy1)=A.length_{half}\cdot(\cos(heading_A),\sin(heading_A))\tag{2} v1 =(dx1,dy1)=A.lengthhalf(cos(headingA),sin(headingA))(2)
横向向量:
v 2 ⃗ = ( d x 2 , d y 2 ) = A . w i d t h h a l f ⋅ ( sin ⁡ ( h e a d i n g A ) , − cos ⁡ ( h e a d i n g A ) ) (3) \vec{v_2}=(dx2,dy2)=A.width_{half}\cdot(\sin(heading_A),-\cos(heading_A))\tag{3} v2 =(dx2,dy2)=A.widthhalf(sin(headingA),cos(headingA))(3)
其中, h e a d i n g A heading_A headingA为A的方向角,则 ( cos ⁡ ( h e a d i n g A ) , s i n ( h e a d i n g A ) ) (\cos(heading_A),\ sin(heading_A)) (cos(headingA), sin(headingA))为A的单位方向向量, ( sin ⁡ ( h e a d i n g A ) , − cos ⁡ ( h e a d i n g A ) (\sin(heading_A),-\cos(heading_A) (sin(headingA),cos(headingA)为A的单位法向量(为啥单位法向量这样表示?可参考线性代数相关知识)。

同理,以下四行代码分别计算的是B的纵向方向和横向方向的两个向量,纵向方向向量和横向方向向量的模分别是B的半长 l e n g t h h a l f length_{half} lengthhalf,半宽 w i d t h h a l f width_{half} widthhalf

  const double dx3 = box.cos_heading() * box.half_length();const double dy3 = box.sin_heading() * box.half_length();const double dx4 = box.sin_heading() * box.half_width();const double dy4 = -box.cos_heading() * box.half_width();

纵向向量:
v 3 ⃗ = ( d x 3 , d y 3 ) = B . l e n g t h h a l f ⋅ ( cos ⁡ ( h e a d i n g B ) , sin ⁡ ( h e a d i n g B ) ) (4) \vec{v_3}=(dx3,dy3)=B.length_{half}\cdot(\cos(heading_B),\sin(heading_B))\tag{4} v3 =(dx3,dy3)=B.lengthhalf(cos(headingB),sin(headingB))(4)
横向向量:
v 4 ⃗ = ( d x 4 , d y 4 ) = B . w i d t h h a l f ⋅ ( sin ⁡ ( h e a d i n g B ) , − cos ⁡ ( h e a d i n g B ) ) (5) \vec{v_4}=(dx4,dy4)=B.width_{half}\cdot(\sin(heading_B),-\cos(heading_B))\tag{5} v4 =(dx4,dy4)=B.widthhalf(sin(headingB),cos(headingB))(5)
其中, h e a d i n g B heading_B headingB为B的方向角,则 ( cos ⁡ ( h e a d i n g B ) , s i n ( h e a d i n g B ) ) (\cos(heading_B),\ sin(heading_B)) (cos(headingB), sin(headingB))为B的单位方向向量, ( sin ⁡ ( h e a d i n g B ) , − cos ⁡ ( h e a d i n g B ) (\sin(heading_B),-\cos(heading_B) (sin(headingB),cos(headingB)为A的单位法向量。

f3

f 3 f3 f3表示的是计算往A纵轴上的投影

std::abs(shift_x * cos_heading_ + shift_y * sin_heading_) <=std::abs(dx3 * cos_heading_ + dy3 * sin_heading_) +std::abs(dx4 * cos_heading_ + dy4 * sin_heading_) +half_length_

如下图所示
往A纵轴方向投影
结合代码和图片一块分析:
(1)代码中std::abs(shift_x * cos_heading_ + shift_y * sin_heading_)所表示的是向量 a b ⃗ \vec{ab} ab 在A的纵轴上投影的模c,结合公式(1)可知:
c = ∣ a b ⃗ ⋅ ( cos ⁡ ( h e a d i n g A ) , sin ⁡ ( h e a d i n g A ) ) ∣ = ∣ x s h i f t ⋅ cos ⁡ ( h e a d i n g A ) + y s h i f t ⋅ sin ⁡ ( h e a d i n g A ) ∣ c=|\vec{ab}\cdot(\cos(heading_A),\sin(heading_A))|=|x_{shift}\cdot\cos(heading_A)+y_{shift}\cdot\sin(heading_A)| c=ab (cos(headingA),sin(headingA))=xshiftcos(headingA)+yshiftsin(headingA)
(2)代码中std::abs(dx3 * cos_heading_ + dy3 * sin_heading_)所表示的是向量 v 3 ⃗ \vec{v_3} v3 在A的纵轴上投影的模 b 1 b1 b1,结合公式(4)可知:
b 1 = ∣ v 3 ⃗ ⋅ ( cos ⁡ ( h e a d i n g A ) , sin ⁡ ( h e a d i n g A ) ) ∣ = ∣ d x 3 ⋅ cos ⁡ ( h e a d i n g A ) + d y 3 ⋅ sin ⁡ ( h e a d i n g A ) ∣ b1=|\vec{v_3}\cdot(\cos(heading_A),\sin(heading_A))|=|dx3\cdot\cos(heading_A)+dy3\cdot\sin(heading_A)| b1=v3 (cos(headingA),sin(headingA))=dx3cos(headingA)+dy3sin(headingA)
代码中std::abs(dx4 * cos_heading_ + dy4 * sin_heading_)所表示的是向量 v 4 ⃗ \vec{v_4} v4 在A的纵轴上投影的模 b 2 b2 b2,结合公式(5)可知:
b 2 = ∣ v 4 ⃗ ⋅ ( cos ⁡ ( h e a d i n g A ) , sin ⁡ ( h e a d i n g A ) ) ∣ = ∣ d x 4 ⋅ cos ⁡ ( h e a d i n g A ) + d y 4 ⋅ sin ⁡ ( h e a d i n g A ) ∣ b2=|\vec{v_4}\cdot(\cos(heading_A),\sin(heading_A))|=|dx4\cdot\cos(heading_A)+dy4\cdot\sin(heading_A)| b2=v4 (cos(headingA),sin(headingA))=dx4cos(headingA)+dy4sin(headingA)
由上图可知:
b = b 1 + b 2 b=b1+b2 b=b1+b2
(3)代码中half_length_是向量 v 1 ⃗ \vec{v_1} v1 在其纵轴上的投影的模,另外,向量 v 2 ⃗ \vec{v_2} v2 此时在其纵轴上投影的模为0。
c 1 = b + l e n g t h h a l f c1=b+length_{half} c1=b+lengthhalf

f4

f 4 f4 f4表示的是计算往A横轴上的投影

 std::abs(shift_x * sin_heading_ - shift_y * cos_heading_) <=std::abs(dx3 * sin_heading_ - dy3 * cos_heading_) +std::abs(dx4 * sin_heading_ - dy4 * cos_heading_) +half_width_

如下图所示
往A横轴方向投影
结合代码和图片一块分析:
(1)代码中std::abs(shift_x * sin_heading_ - shift_y * cos_heading_)所表示的是向量 a b ⃗ \vec{ab} ab 在A的横轴上投影的模c,结合公式(1)可知:
c = ∣ a b ⃗ ⋅ ( sin ⁡ ( h e a d i n g A ) , − cos ⁡ ( h e a d i n g A ) ) ∣ = ∣ x s h i f t ⋅ sin ⁡ ( h e a d i n g A ) − y s h i f t ⋅ cos ⁡ ( h e a d i n g A ) ∣ c=|\vec{ab}\cdot(\sin(heading_A),-\cos(heading_A))|=|x_{shift}\cdot\sin(heading_A)-y_{shift}\cdot\cos(heading_A)| c=ab (sin(headingA),cos(headingA))=xshiftsin(headingA)yshiftcos(headingA)
(2)代码中std::abs(dx3 * sin_heading_ - dy3 * cos_heading_)所表示的是向量 v 3 ⃗ \vec{v_3} v3 在A的横轴上投影的模 b 1 b1 b1,结合公式(4)可知:
b 1 = ∣ v 3 ⃗ ⋅ ( sin ⁡ ( h e a d i n g A ) , − cos ⁡ ( h e a d i n g A ) ) ∣ = ∣ d x 3 ⋅ sin ⁡ ( h e a d i n g A ) − d y 3 ⋅ cos ⁡ ( h e a d i n g A ) ∣ b1=|\vec{v_3}\cdot(\sin(heading_A),-\cos(heading_A))|=|dx3\cdot\sin(heading_A)-dy3\cdot\cos(heading_A)| b1=v3 (sin(headingA),cos(headingA))=dx3sin(headingA)dy3cos(headingA)
代码中std::abs(dx4 * sin_heading_ - dy4 * cos_heading_)所表示的是向量 v 4 ⃗ \vec{v_4} v4 在A的横轴上投影的模 b 2 b2 b2,结合公式(5)可知:
b 2 = ∣ v 4 ⃗ ⋅ ( sin ⁡ ( h e a d i n g A ) , − cos ⁡ ( h e a d i n g A ) ) ∣ = ∣ d x 4 ⋅ sin ⁡ ( h e a d i n g A ) − d y 4 ⋅ cos ⁡ ( h e a d i n g A ) ∣ b2=|\vec{v_4}\cdot(\sin(heading_A),-\cos(heading_A))|=|dx4\cdot\sin(heading_A)-dy4\cdot\cos(heading_A)| b2=v4 (sin(headingA),cos(headingA))=dx4sin(headingA)dy4cos(headingA)
由上图可知:
b = b 1 + b 2 b=b1+b2 b=b1+b2
(3)代码中half_width_是向量 v 2 ⃗ \vec{v_2} v2 在其横轴上的投影的模,另外,向量 v 1 ⃗ \vec{v_1} v1 此时在其横轴上投影的模为0。
c 1 = b + w i d t h h a l f c1=b+width_{half} c1=b+widthhalf

f5

f 5 f5 f5表示的是计算往B纵轴上的投影

std::abs(shift_x * box.cos_heading() + shift_y * box.sin_heading()) <=std::abs(dx1 * box.cos_heading() + dy1 * box.sin_heading()) +std::abs(dx2 * box.cos_heading() + dy2 * box.sin_heading()) +box.half_length()

如下图所示:
往B纵轴方向投影
结合代码和图片一块分析:
(1)代码中std::abs(shift_x * box.cos_heading() + shift_y * box.sin_heading())所表示的是向量 a b ⃗ \vec{ab} ab 在B的纵轴上投影的模c,结合公式(1)可知:
c = ∣ a b ⃗ ⋅ ( cos ⁡ ( h e a d i n g B ) , sin ⁡ ( h e a d i n g B ) ) ∣ = ∣ x s h i f t ⋅ cos ⁡ ( h e a d i n g B ) + y s h i f t ⋅ sin ⁡ ( h e a d i n g B ) ∣ c=|\vec{ab}\cdot(\cos(heading_B),\sin(heading_B))|=|x_{shift}\cdot\cos(heading_B)+y_{shift}\cdot\sin(heading_B)| c=ab (cos(headingB),sin(headingB))=xshiftcos(headingB)+yshiftsin(headingB)
(2)代码中std::abs(dx1 * box.cos_heading() + dy1 * box.sin_heading())所表示的是向量 v 1 ⃗ \vec{v_1} v1 在B的纵轴上投影的模 a 1 a1 a1,结合公式(2)可知:
a 1 = ∣ v 1 ⃗ ⋅ ( cos ⁡ ( h e a d i n g B ) , sin ⁡ ( h e a d i n g B ) ) ∣ = ∣ d x 1 ⋅ cos ⁡ ( h e a d i n g B ) + d y 1 ⋅ sin ⁡ ( h e a d i n g B ) ∣ a1=|\vec{v_1}\cdot(\cos(heading_B),\sin(heading_B))|=|dx1\cdot\cos(heading_B)+dy1\cdot\sin(heading_B)| a1=v1 (cos(headingB),sin(headingB))=dx1cos(headingB)+dy1sin(headingB)
代码中std::abs(dx2 * box.cos_heading() + dy2 * box.sin_heading())所表示的是向量 v 2 ⃗ \vec{v_2} v2 在B的纵轴上投影的模 a 2 a2 a2,结合公式(3)可知:
a 2 = ∣ v 2 ⃗ ⋅ ( cos ⁡ ( h e a d i n g B ) , sin ⁡ ( h e a d i n g B ) ) ∣ = ∣ d x 2 ⋅ cos ⁡ ( h e a d i n g B ) + d y 2 ⋅ sin ⁡ ( h e a d i n g B ) ∣ a2=|\vec{v_2}\cdot(\cos(heading_B),\sin(heading_B))|=|dx2\cdot\cos(heading_B)+dy2\cdot\sin(heading_B)| a2=v2 (cos(headingB),sin(headingB))=dx2cos(headingB)+dy2sin(headingB)
由上图可知:
a = a 1 + a 2 a=a1+a2 a=a1+a2
(3)代码中half_length是向量 v 3 ⃗ \vec{v_3} v3 在其纵轴上的投影的模,另外,向量 v 4 ⃗ \vec{v_4} v4 此时在其纵轴上投影的模为0。
c 1 = a + l e n g t h h a l f c1=a+length_{half} c1=a+lengthhalf

f6

f 6 f6 f6表示的是计算往B横轴上的投影

std::abs(shift_x * box.sin_heading() - shift_y * box.cos_heading()) <=std::abs(dx1 * box.sin_heading() - dy1 * box.cos_heading()) +std::abs(dx2 * box.sin_heading() - dy2 * box.cos_heading()) +box.half_width()

如下图所示:
往B横轴方向投影
结合代码和图片一块分析:
(1)代码中std::abs(shift_x * box.sin_heading() - shift_y * box.cos_heading())所表示的是向量 a b ⃗ \vec{ab} ab 在B的横轴上投影的模c,结合公式(1)可知:
c = ∣ a b ⃗ ⋅ ( sin ⁡ ( h e a d i n g B ) , − cos ⁡ ( h e a d i n g B ) ) ∣ = ∣ x s h i f t ⋅ sin ⁡ ( h e a d i n g B ) − y s h i f t ⋅ cos ⁡ ( h e a d i n g B ) ∣ c=|\vec{ab}\cdot(\sin(heading_B),-\cos(heading_B))|=|x_{shift}\cdot\sin(heading_B)-y_{shift}\cdot\cos(heading_B)| c=ab (sin(headingB),cos(headingB))=xshiftsin(headingB)yshiftcos(headingB)
(2)代码中std::abs(dx1 * box.sin_heading() - dy1 * box.cos_heading())所表示的是向量 v 1 ⃗ \vec{v_1} v1 在B的横轴上投影的模 a 1 a1 a1,结合公式(2)可知:
a 1 = ∣ v 1 ⃗ ⋅ ( sin ⁡ ( h e a d i n g B ) , − cos ⁡ ( h e a d i n g B ) ) ∣ = ∣ d x 1 ⋅ sin ⁡ ( h e a d i n g B ) − d y 1 ⋅ cos ⁡ ( h e a d i n g B ) ∣ a1=|\vec{v_1}\cdot(\sin(heading_B),-\cos(heading_B))|=|dx1\cdot\sin(heading_B)-dy1\cdot\cos(heading_B)| a1=v1 (sin(headingB),cos(headingB))=dx1sin(headingB)dy1cos(headingB)
代码中std::abs(dx2 * box.sin_heading() - dy2 * box.cos_heading())所表示的是向量 v 2 ⃗ \vec{v_2} v2 在B的横轴上投影的模 a 2 a2 a2,结合公式(3)可知:
a 2 = ∣ v 2 ⃗ ⋅ ( sin ⁡ ( h e a d i n g B ) , − cos ⁡ ( h e a d i n g B ) ) ∣ = ∣ d x 2 ⋅ sin ⁡ ( h e a d i n g B ) − d y 2 ⋅ cos ⁡ ( h e a d i n g B ) ∣ a2=|\vec{v_2}\cdot(\sin(heading_B),-\cos(heading_B))|=|dx2\cdot\sin(heading_B)-dy2\cdot\cos(heading_B)| a2=v2 (sin(headingB),cos(headingB))=dx2sin(headingB)dy2cos(headingB)
由上图可知:
a = a 1 + a 2 a=a1+a2 a=a1+a2
(3)代码中half_width是向量 v 4 ⃗ \vec{v_4} v4 在其横轴上的投影的模,另外,向量 v 3 ⃗ \vec{v_3} v3 此时在其横轴上投影的模为0。
c 1 = a + w i d t h h a l f c1=a+width_{half} c1=a+widthhalf

若步骤f3~f6均满足 c < = c 1 c<=c1 c<=c1,则可判定两个Box存在碰撞(具体原理可参考OBB原理)。

参考

[1] Apollo中Lattice轨迹碰撞检测
[2]自动驾驶运动规划中的碰撞检测

这篇关于百度Apollo规划算法——OBB障碍物检测代码解析的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/750067

相关文章

网页解析 lxml 库--实战

lxml库使用流程 lxml 是 Python 的第三方解析库,完全使用 Python 语言编写,它对 XPath表达式提供了良好的支 持,因此能够了高效地解析 HTML/XML 文档。本节讲解如何通过 lxml 库解析 HTML 文档。 pip install lxml lxm| 库提供了一个 etree 模块,该模块专门用来解析 HTML/XML 文档,下面来介绍一下 lxml 库

不懂推荐算法也能设计推荐系统

本文以商业化应用推荐为例,告诉我们不懂推荐算法的产品,也能从产品侧出发, 设计出一款不错的推荐系统。 相信很多新手产品,看到算法二字,多是懵圈的。 什么排序算法、最短路径等都是相对传统的算法(注:传统是指科班出身的产品都会接触过)。但对于推荐算法,多数产品对着网上搜到的资源,都会无从下手。特别当某些推荐算法 和 “AI”扯上关系后,更是加大了理解的难度。 但,不了解推荐算法,就无法做推荐系

百度/小米/滴滴/京东,中台架构比较

小米中台建设实践 01 小米的三大中台建设:业务+数据+技术 业务中台--从业务说起 在中台建设中,需要规范化的服务接口、一致整合化的数据、容器化的技术组件以及弹性的基础设施。并结合业务情况,判定是否真的需要中台。 小米参考了业界优秀的案例包括移动中台、数据中台、业务中台、技术中台等,再结合其业务发展历程及业务现状,整理了中台架构的核心方法论,一是企业如何共享服务,二是如何为业务提供便利。

康拓展开(hash算法中会用到)

康拓展开是一个全排列到一个自然数的双射(也就是某个全排列与某个自然数一一对应) 公式: X=a[n]*(n-1)!+a[n-1]*(n-2)!+...+a[i]*(i-1)!+...+a[1]*0! 其中,a[i]为整数,并且0<=a[i]<i,1<=i<=n。(a[i]在不同应用中的含义不同); 典型应用: 计算当前排列在所有由小到大全排列中的顺序,也就是说求当前排列是第

csu 1446 Problem J Modified LCS (扩展欧几里得算法的简单应用)

这是一道扩展欧几里得算法的简单应用题,这题是在湖南多校训练赛中队友ac的一道题,在比赛之后请教了队友,然后自己把它a掉 这也是自己独自做扩展欧几里得算法的题目 题意:把题意转变下就变成了:求d1*x - d2*y = f2 - f1的解,很明显用exgcd来解 下面介绍一下exgcd的一些知识点:求ax + by = c的解 一、首先求ax + by = gcd(a,b)的解 这个

综合安防管理平台LntonAIServer视频监控汇聚抖动检测算法优势

LntonAIServer视频质量诊断功能中的抖动检测是一个专门针对视频稳定性进行分析的功能。抖动通常是指视频帧之间的不必要运动,这种运动可能是由于摄像机的移动、传输中的错误或编解码问题导致的。抖动检测对于确保视频内容的平滑性和观看体验至关重要。 优势 1. 提高图像质量 - 清晰度提升:减少抖动,提高图像的清晰度和细节表现力,使得监控画面更加真实可信。 - 细节增强:在低光条件下,抖

【数据结构】——原来排序算法搞懂这些就行,轻松拿捏

前言:快速排序的实现最重要的是找基准值,下面让我们来了解如何实现找基准值 基准值的注释:在快排的过程中,每一次我们要取一个元素作为枢纽值,以这个数字来将序列划分为两部分。 在此我们采用三数取中法,也就是取左端、中间、右端三个数,然后进行排序,将中间数作为枢纽值。 快速排序实现主框架: //快速排序 void QuickSort(int* arr, int left, int rig

动态规划---打家劫舍

题目: 你是一个专业的小偷,计划偷窃沿街的房屋。每间房内都藏有一定的现金,影响你偷窃的唯一制约因素就是相邻的房屋装有相互连通的防盗系统,如果两间相邻的房屋在同一晚上被小偷闯入,系统会自动报警。 给定一个代表每个房屋存放金额的非负整数数组,计算你 不触动警报装置的情况下 ,一夜之内能够偷窃到的最高金额。 思路: 动态规划五部曲: 1.确定dp数组及含义 dp数组是一维数组,dp[i]代表

【C++】_list常用方法解析及模拟实现

相信自己的力量,只要对自己始终保持信心,尽自己最大努力去完成任何事,就算事情最终结果是失败了,努力了也不留遗憾。💓💓💓 目录   ✨说在前面 🍋知识点一:什么是list? •🌰1.list的定义 •🌰2.list的基本特性 •🌰3.常用接口介绍 🍋知识点二:list常用接口 •🌰1.默认成员函数 🔥构造函数(⭐) 🔥析构函数 •🌰2.list对象

活用c4d官方开发文档查询代码

当你问AI助手比如豆包,如何用python禁止掉xpresso标签时候,它会提示到 这时候要用到两个东西。https://developers.maxon.net/论坛搜索和开发文档 比如这里我就在官方找到正确的id描述 然后我就把参数标签换过来